https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90408
Bug ID: 90408 Summary: >= -O2 suddenly generates code Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: oliverst at online dot de Target Milestone: --- Created attachment 46324 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46324&action=edit example code The attached code should produce an empty main(), but does produce code with optimizations >= -O2. It appears to be related to the switch-case. -std=c++11 -O1 no code generated -std=c++11 -O2 code generated in GCC 5.5.0 and GCC >= 7.1 Also using -Os produces more code than -O1.