| Summary: | gcc with -fexceptions and no -O increases stack usage by local variables | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Laine Stump <laine> |
| Component: | gcc | Assignee: | Jakub Jelinek <jakub> |
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 17 | CC: | eblake, jakub, law |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-04-06 19:00:25 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
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. |
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.