Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-08

"Continue" not work properly in except clause on win64

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Toru Takubo

Hi all,

I'm trying FPC 3.0.0-rc1 and find "Continue" does not work properly in except clause but just jump to finally clause on win64.

Here is a sample code:
----------------------------
program sample;

{$mode objfpc}
uses
   SysUtils;
var
  i: Integer;
begin
  try
    for i:=0 to 2 do begin
      try
        Writeln(IntToStr(i));
        raise Exception.Create('');
      except
        Continue;
      end;
    end;
  finally
    Writeln('done.');
    Readln;
  end;
end.
----------------------------

The result on win32:
----------------------------
0
1
2
done.
----------------------------

The result on win64
----------------------------
0
done.
----------------------------

Why such difference? Is this a bug?

Regards,

Toru

Sven Barth
to Toru Takubo
"Toru Takubo" wrote 48 lines
Hi all, I'm trying FPC 3.0.0-rc1 and find "Continue" does not work properly in except clause but just jump to finally clause on win64. Here is a sample code: ---------------------------- program sample; {$mode objfpc} uses SysUtils; var i: Integer; begin try for i:=0 to 2 do begin try Writeln(IntToStr(i)); raise Exception.Create(''); except Continue; end; end; finally Writeln('done.'); Readln; end; end. ---------------------------- The result on win32: ---------------------------- 0 1 2 done. ---------------------------- The result on win64 ---------------------------- 0 done. ---------------------------- Why such difference? Is this a bug?

It's because since 2.7.1 a different exception handling mechanism is used on Win64 (and also Win32 if enabled). But yes, it should probably be considered as a bug, so please file a bug report. As a workaround you could use a boolean variable that you set inside the handler and evaluate it afterwards.

Regards,
Sven

Toru Takubo
to Sven Barth
Sven Barth wrote 55 lines
Am 28.08.2015 11:08 schrieb "Toru Takubo" < >: > > Hi all, > > I'm trying FPC 3.0.0-rc1 and find "Continue" does not work properly > in except clause but just jump to finally clause on win64. > > Here is a sample code: > ---------------------------- > program sample; > > {$mode objfpc} > > uses > SysUtils; > var > i: Integer; > begin > try > for i:=0 to 2 do begin > try > Writeln(IntToStr(i)); > raise Exception.Create(''); > except > Continue; > end; > end; > finally > Writeln('done.'); > Readln; > end; > end. > ---------------------------- > > The result on win32: > ---------------------------- > 0 > 1 > 2 > done. > ---------------------------- > > The result on win64 > ---------------------------- > 0 > done. > ---------------------------- > > Why such difference? Is this a bug? It's because since 2.7.1 a different exception handling mechanism is used on Win64 (and also Win32 if enabled). But yes, it should probably be considered as a bug, so please file a bug report. As a workaround you could use a boolean variable that you set inside the handler and evaluate it afterwards. Regards, Sven

Thank you for your explanation. I will submit a bug report.

Regards,

Toru