|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: [Full-Disclosure] gcc: Internal compiler error: program cc1 got fatal signal 11
Valdis.Kletnieks
vt.edu
Date: Thu Jan 08 2004 - 22:04:52 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Exmh version 2.5 07/13/2001
iD8DBQE//ihkcC3lWbTT17ARAlNNAJ0eiPvYR7TTzF8Yvx8Pg5/7gtYN6QCg4Q9U
Wnao6uE9xnkamVsSiX+FJlw=
=tlz3
-----END PGP SIGNATURE-----
_______________________________________________
Full-Disclosure - We believe in it.
Charter: http://lists.netsys.com/full-disclosure-charter.html
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]