https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69451
Bug ID: 69451 Summary: want a high-level option to disable optimizations that harm debuggability Product: gcc Version: 5.3.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: driver Assignee: unassigned at gcc dot gnu.org Reporter: richlowe at richlowe dot net CC: alan.coopersmith at oracle dot com Target Milestone: --- There are several optimization passes in the compiler which make debugging, tracing, and the like, unnecessarily cumbersome. The big and obvious examples that spring to mind are optimizations that clone functions and Identical Code Folding (which does the opposite). Each makes tracing, placing breakpoints, etc, error prone and frustrating. A lot of optimization passes in question are indeed documented in this regard. It would be fantastic to have a high-level option which disabled optimizations which harm debugging in this way, so that users have a reliable way to do so without researching any optimization in each new release. I would suggest that any optimization which: - Changed the number or order of parameters - Passed parameters in a way other than defined by the relevant ABI - Cloned a function such that a logical function had more than one copy in text, with gensym'd names. - ICF'd a function such that a logical function had no copy in text, but was instead aliased to another Should be disabled by the desired flag.