[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gm2] Mac OS X: arrayhuge/arrayhuge2 Failures
From: |
Gaius Mulley |
Subject: |
Re: [Gm2] Mac OS X: arrayhuge/arrayhuge2 Failures |
Date: |
03 Jan 2006 13:38:44 +0000 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 |
Michael Lambert <address@hidden> writes:
> 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:
Hi Michael,
any chance you can email me the result of the following program:
#include <stdio.h>
#define printtype(X) printf("size of " #X " is %d bytes\n", sizeof(X))
main()
{
printtype(short);
printtype(short int);
printtype(int);
printtype(unsigned int);
printtype(char);
printtype(char *);
printtype(void *);
printtype(long);
printtype(long int);
printtype(long long int);
printtype(float);
printtype(double);
printtype(long double);
}
I presume the G5 is using the LP64 model (long and pointers are 64
bits, ints are 32 bits wide).
>
> % 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.
>
Thanks for the reports.. I think the arrayhuge also fails on 32 i386
currently - hopefully both architectures can be fixed together,
regards,
Gaius
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Gm2] Mac OS X: arrayhuge/arrayhuge2 Failures,
Gaius Mulley <=