https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80032
Bug ID: 80032 Summary: C++ excessive stack usage (no stack reuse) Product: gcc Version: 6.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: jan.smets at nokia dot com Target Milestone: --- Created attachment 40959 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40959&action=edit testcase I have a unlucky code pattern that resulted in 10592 bytes stack usage when built with GCC 6.3, whereas it only used 304 bytes when compiled with GCC 5.4. gcc-5 (Ubuntu 5.4.1-8ubuntu1) 5.4.1 20170304 gcc (Ubuntu 6.3.0-8ubuntu1) 6.3.0 20170221 Attached is a C-Reduced testcase. If the if() block is repeated multiple times the stack increases more. Looks as if stack isn't reused. if() block occurs 1x : GCC5: 96 bytes , GCC6: 96 bytes 2x : GCC5: 112 bytes , GCC6: 176 bytes 10x : GCC5: 112 bytes , GCC6: 688 bytes Testcase compiled with : -fstack-usage -std=c++11 -O2 -Wall Using -fstack-reuse=none gives GCC 5 the same stack usage as GCC 6. I think this is a regression.