Hide Forgot
Description of problem: When Fedora 17's gcc is run with: -Wframe-larger-than=4096 -Werror -fexceptions on some files that compiled without error in Fedora 16 (gcc-4.6.3-2), it fails with, e.g.: test.c: In function ‘main’: test.c:20:4: error: the frame size of 6016 bytes is larger than 4096 bytes [-Werror=frame-larger-than=] Version-Release number of selected component (if applicable): gcc-4.7.0-1.fc17.x86_64 How reproducible: 100% Steps to Reproduce: 1) Put this small program into /tmp/test.c: #include <stdio.h> void main() { char test1[1]; { char test2[3000]; printf(test2); } { char test3[3000]; printf(test3); } } 2) cc -Wframe-larger-than=4096 -Werror -fexceptions /tmp/test.c Actual results: /tmp/test.c: In function ‘main’: /tmp/test.c:15:4: error: the frame size of 6016 bytes is larger than 4096 bytes [-Werror=frame-larger-than=] cc1: all warnings being treated as errors Expected results: Should exit silently (and does so when run on Fedora 16) Additional info: 1) adding -O<anything-but-0> eliminates the failure 1) removing -fexceptions eliminates the failure 2) removing "char test1[1];" from main() also eliminates the failure 3) even changing "char test1[1];" to "char test1;" eliminates the failure Apparently when all of the above conditions are set just right, gcc now doesn't reuse stack space, while it previously did. This is causing build failures of applications that used to build; while the failures can be remedied, it is annoying and a regression in efficient use of the stack.
This is a user error, if you need small stack frames, you just shouldn't use -O0. -O0 is mainly for fast compilation and debuggability, and stack sharing is quite compile time consuming.