This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/11333] New: negative indexes for array static initializers cause an internal compiler error


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11333

           Summary: negative indexes for array static initializers cause an
                    internal compiler error
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tharbaugh at lnxi dot com
                CC: gcc-bugs at gcc dot gnu dot org

#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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]