Comment 5 for bug 589855

Revision history for this message
Kees Cook (kees) wrote : Re: incorrect stack size calculation when building with -O0

Here's a more minimal test case. It looks like the compiler isn't correctly calculating function stack sizes when building without optimization.

$ gcc -Wall test.c -o test -O1
$ ./test
74.125.127.104
$ gcc -Wall test.c -o test -O0
$ ./test
74.125.127.103
Segmentation fault (core dumped)

Happens with gcc-snapshot in Maverick too:

$ /usr/lib/gcc-snapshot/bin/gcc -Wall test.c -o test -O0
$ ./test
74.125.127.99
Segmentation fault (core dumped)