Bug 11333 - negative indexes for array static initializers cause an internal compiler error
Summary: negative indexes for array static initializers cause an internal compiler error
Status: RESOLVED DUPLICATE of bug 11207
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.3
: P3 minor
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-06-26 17:25 UTC by Thayne Harbaugh
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thayne Harbaugh 2003-06-26 17:25:06 UTC
#define BROKEN 1

int
main( int argc, char *argv[] ) {
	int ints[] = {
#if BROKEN
		[-1] = 5,
#endif
		[0]  = 6
	};

	return ints[0];
}


The above was saved in a file called /tmp/foo.c


[thayne@torch ecc_new]$ gcc -v -save-temps /tmp/foo.c -o /tmp/foo
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.3 20030615 (Red Hat Linux 3.3-7)
 /usr/lib/gcc-lib/i386-redhat-linux/3.3/cc1 -E -quiet -v -D__GNUC__=3
-D__GNUC_MINOR__=3 -D__GNUC_PATCHLEVEL__=0 /tmp/foo.c foo.i
ignoring nonexistent directory "/usr/i386-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc-lib/i386-redhat-linux/3.3/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i386-redhat-linux/3.3/cc1 -fpreprocessed foo.i -quiet
-dumpbase foo.c -auxbase foo -version -o foo.s
GNU C version 3.3 20030615 (Red Hat Linux 3.3-7) (i386-redhat-linux)
	compiled by GNU C version 3.3 20030615 (Red Hat Linux 3.3-7).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
/tmp/foo.c: In function `main':
/tmp/foo.c:7: internal compiler error: in tree_low_cst, at tree.c:3228
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
The bug is not reproduceable, so it is likely a hardware or OS problem



Strangely, the bug is very reproduceable - contrary to the line above.

A negative index for an array static initializer should produce an error message
describing the problem - not an internal compiler error.
Comment 1 Andrew Pinski 2003-06-26 17:33:15 UTC
This is a dup of bug 11207 which is not fixed yet.

*** This bug has been marked as a duplicate of 11207 ***