Page 1 of 1

Pascal Compiler x86 [truncate] attribute

Posted: Mon Aug 14, 2023 6:08 pm
by rodprince
Issue with the x86 Pascal Compiler.

VSI Pasacl x64-64 X6.3-138 (50x6f) on OpenVMS x86-64 V9.2-1

If you use a [truncate] attribute in a procedure,. you throw an access violation if the parameter is not specified from the calling code.

Code: Select all

program test(input, output)
type
varying_string = varying [132] of char;

procedure do_error (action : [truncate] varying_string);
begin
  if present( action ) then
    begin
    writeln( action );
    end
  else
    begin
    writeln( "no action" );
    end;
end;

begin
  do_error;
end.

Re: Pascal Compiler x86 [truncate] attribute

Posted: Tue Aug 15, 2023 5:57 pm
by rodprince
I forgot to mention, if you compile & link with /debug it appears to work fine. The access vio is in non-debug code.

Re: Pascal Compiler x86 [truncate] attribute

Posted: Wed Aug 16, 2023 2:03 pm
by jreagan
I think I fixed this for the next kit. I'll try it and let you know.

I hope to get the out this week or next week.

Re: Pascal Compiler x86 [truncate] attribute

Posted: Thu Aug 17, 2023 9:50 am
by jreagan
I tried it with my latest compiler and it still fails with /OPTIMIZE. I think the issue is that the optimizer either inline expanded that call to do_error (or turned it into a tail call by jumping to do_error) and the 0 arg-count got turned into a non-zero arg-count. /NOOPTIMZE avoids it.