This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Gcc 3.x regression in constant initializer [compile/20010327-1.c]
- To: gcc at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Subject: Gcc 3.x regression in constant initializer [compile/20010327-1.c]
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Fri, 02 Nov 2001 21:26:24 +0100
Hi!
I've found a regression in 3.1 compared to gcc 2.95. The following code:
extern void _text;
static unsigned int x = (unsigned int) &_text - 0x10000000L - 1;
static int x1 = (int) &_text - 0x10000000L - 1;
static long x2 = (long) &_text - 0x10000000L - 1;
static __SIZE_TYPE__ x3 = (__SIZE_TYPE__) &_text - 0x10000000L - 1;
compiles correctly with GCC 2.95.3 on i386. It fails with 3.1 and
also with a `gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)'.
The following initialization:
static unsigned int x = (unsigned int) &_text - 0x10000000L - 1;
was working with 2.95 and it fails now with:
/tmp/bug-1.c:2: initializer element is not computable at load time
This problem is now in evidence after I integrated:
2001-11-01 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* gcc.c-torture/compile/20010327-1.c: Use __SIZE_TYPE__ instead
of unsigned long.
and it explains the failure for compile/20010327-1.c on i386 and ppc-eabisim
(at least).
Until a fix is found, I suggest to keep my patch, even if it introduces new
failures in native and ppc-eabisim validation. OK?
Stephane