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

Re: [Full-Disclosure] gcc: Internal compiler error: program cc1 got fatal signal 11



On Thu, 08 Jan 2004 23:12:46 +0200, Georgi Guninski <guninski@guninski.com>  
said:
> $ gcc --version
> 2.95.3
> $ cat gcc-crash.c
> int main(void)
> {
> printf("%c","msux"[0xcafebabe]);
> }
> $ gcc gcc-crash.c
> gcc: Internal compiler error: program cc1 got fatal signal 11

OK. To sum up:

1) "msux" ends up creating a semi-anonymous 5-byte long array, initialized to
that string.

2) 0xcafebabe as an index will try to get either the 3405691582 or -889275713 
byte
of that string (depending on whether your compiler thinks it's a signed or 
unsigned index.
In either case, it points WAYY into the boonies.

3) This is why it *will* segfault at runtime.  If it *fails* to segfault at 
runtime,
you have a *very* weird system indeed (or possibly very weird compiler flags ;)

4)  gcc 2.95 is bombing out because it sees that the string is a constant, the 
index
is a constant, and it's trying to reduce it at compile time (similar to how if
you had used "msux"[3] it could replace that with a 'x').  It's failing to note 
that
the index is out-of-range of the string.

Attachment: pgp00014.pgp
Description: PGP signature