gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] Mac OS X: arrayhuge/arrayhuge2 Failures


From: Michael Lambert
Subject: [Gm2] Mac OS X: arrayhuge/arrayhuge2 Failures
Date: Thu, 29 Dec 2005 22:43:06 -0500
User-agent: Thunderbird 1.5 (Macintosh/20051201)

I can build gcc-3.3.6+CVS under Mac OS X 10.4.3 (G5 processor) without incident. However, I'm currently seeing 15 unexpected errors in 'make check-gm2'.

Compiling testsuite/gm2/pim/pass/arrayhuge.mod by hand:

% gm2 -c arrayhuge.mod
arrayhuge.mod:1: warning: overflow in constant expression
arrayhuge.mod:1: warning: overflow in constant expression
arrayhuge.mod:1: warning: overflow in constant expression

It looks as though MAX(CARDINAL) is the likely culprit, so I write a little test program:

% cat test_card.mod
MODULE test_card;

FROM StrIO IMPORT WriteString, WriteLn;
FROM NumberIO IMPORT WriteCard;

BEGIN
   WriteString('The largest CARDINAL is: ');
   WriteCard(MAX(CARDINAL), 20); WriteLn;
END test_card.
% gm2 -c test_card.mod
% gm2 -o test_card test_card.mod
% ./test_card
The largest CARDINAL is:           4294967295

I'm halfway surprised that the output is 2^32-1 and not 2^64-1, but at least it is plausible. So let's try putting explicit numbers in arrayhuge.mod rather than using calls to MAX() in array indices:

% cat foo.mod
MODULE foo;

CONST
   c = 2147483651;
VAR
   a: ARRAY [c-4..c] OF CHAR ;
   i: CARDINAL ;
BEGIN
   a[c-1] := 'd' ;
   a[c-4] := 'a' ;
   FOR i := c-4 TO c DO
      a[i] := 'z'
   END
END foo.
% gm2 -c foo.mod
%

Happiness!

BUT...  If I change 'c = 2147483651' to 'c = 2147483652':

% cat foo.mod
MODULE foo;

CONST
   c = 2147483652;
VAR
   a: ARRAY [c-4..c] OF CHAR ;
   i: CARDINAL ;
BEGIN
   a[c-1] := 'd' ;
   a[c-4] := 'a' ;
   FOR i := c-4 TO c DO
      a[i] := 'z'
   END
END foo.
% gm2 -c foo.mod
foo.mod:1: warning: overflow in constant expression
foo.mod:1: warning: overflow in constant expression
foo.mod:1: warning: overflow in constant expression

So it works for c <= 2^31+3, but fails for larger values of c (at least I'm assuming it fails for all larger values). Weird. I would have expected success for 2^31 to mean success for 2^32-1.

Presumably the fix for arrayhuge will also fix arrayhuge2. That would bring me down to nine unexpected failures.

Michael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]