Sign in Join

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

Mailing lists / fpc-pascal / 2021-05

FPC 3.2.2 (In)complete Boolean Evaluation on 32bit MacOS

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

Tobias Giesen

Hello,
it seems that the newest 32-bit FPC sometimes creates complete Boolean Evaluation rather than partial, which causes my application to crash. My context is like this:

type BOOL=LongBool;
         PBOOL=^LongBool;
function DoSomething(const Cancel:PBOOL=nil);
begin
   if Assigned(Cancel) and Cancel^ then
      Exit;
   end;

This crashes because Cancel and Cancel^ are always evaluated, even if Cancel is nil.

It works fine in 64-bit.

Is this a known problem?

Cheers,
Tobias

Reply by email

Pierre Muller
to Tobias Giesen

Hi all,

I took the liberty to report a bug issue about this problem, which I was able to reproduce on x86_64 3.2.2 release compiler.

See
https://bugs.freepascal.org/view.php?id=38973
for more details,

Thanks for reporting,

Pierre Muller

Le 30/05/2021 à 15:47, Tobias Giesen via fpc-pascal a écrit :

Show quoted text 27 lines
Hello, it seems that the newest 32-bit FPC sometimes creates complete Boolean Evaluation rather than partial, which causes my application to crash. My context is like this: type BOOL=LongBool; PBOOL=^LongBool; function DoSomething(const Cancel:PBOOL=nil); begin if Assigned(Cancel) and Cancel^ then Exit; end; This crashes because Cancel and Cancel^ are always evaluated, even if Cancel is nil. It works fine in 64-bit. Is this a known problem? Cheers, Tobias _______________________________________________ fpc-pascal maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email