The following code works correctly if --no-range-checking, but fails with range checking enabled (as it is by default).
% gp --no-range-checking peterY.pas % ./peterY OK % gp peterY.pas % ./peterY failed
Looking at the assembly, it seems erroneously pass a local variable address (temporary?) to the var parameter.
Thanks, Peter.
program peterX;
type SInt32 = Integer attribute( size = 32 ); UInt32 = Cardinal attribute( size = 32 );
procedure Doit( var x: SInt32 ); begin x := 5; end;
var y: UInt32; begin y := 1; Doit( SInt32(y) ); if y = 5 then begin WriteLn( 'OK' ); end else begin WriteLn( 'failed' ); end; end.