[fpc-devel] Issue 3.2.3 (ok in 3.3.1) Win64 "raise exception" does not go to "except"

Martin Frb lazarus at mfriebe.de
Thu Jan 13 16:49:55 CET 2022


In the  below code compiled with 3.2.3 (today and early Dec)
when the exception is reached the app exits.

There is no code from finally, nor from except block executed.

The "randomize" is just to put some code into each block. No special 
meaning otherwise.

This issue is on Win64. (works for 32 bit Win)
And appears to be ok in 3.3.1.

     program Project1;
     {$mode objfpc}{$H+}

     uses SysUtils;

     var
       bar: boolean;

     procedure Foo;
     begin
       while true do begin
         try
           try
             try
               if bar then
                 raise Exception.Create('');
               Randomize;
             finally
               Randomize;
               try
                 Randomize;
               finally
                 Randomize;
               end;
             end;
             Randomize;
           finally
             Randomize;
           end;
           Randomize;
         except
           bar := false;
           Randomize;
         end;
       end;
     end;

     begin
       bar := true;
       Foo;
     end.



More information about the fpc-devel mailing list