Hi all,
this looks like a bug: non-negative integer constants are treated as LongestCard, i.e. an unsigned type.
[pas]% gpc -v Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/2.95.2/specs gpc version 20020402, based on 2.95.2 19991024 (release) [pas]% cat sign.pas program Foo (Output);
const Two = 2;
begin if (0 < Two - 23) or (3 < 13 - 42) then WriteLn ('failed: ', Two - 23, ', ', 13 - 42) else WriteLn ('OK') end. [pas]% gpc sign.pas [pas]% ./a.out failed: 18446744073709551595, 18446744073709551587
And an unrelated one: a schema discriminant is not initialized in the situation below.
[pas]% cat schema.pas program Foo (Output);
type A (N: Integer) = Integer; B (N: Integer) = array [1 .. N] of A (N);
var C : B (7);
begin if (C.N = 7) and (C[3].N = 7) then WriteLn ('OK') else WriteLn ('failed: ', C.N, ' ', C[3].N) end. [pas]% gpc schema.pas [pas]% ./a.out failed: 7 0
Emil Jerabek
Emil Jerabek wrote:
this looks like a bug: non-negative integer constants are treated as LongestCard, i.e. an unsigned type.
Not exactly (they were treated as signed, but when building the difference, there was a check if the operands are constant and positive in which case to do the operation unsigned -- which is valid for many operations, but not `-'). Fixed now. (emil18.pas)
And an unrelated one: a schema discriminant is not initialized in the situation below.
Also fixed. (emil19*.pas)
Again, thanks for the reports.
Frank