https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102523

            Bug ID: 102523
           Summary: Assume -fvar-tracking -fvar-tracking-assignments when
                    compiling with -O0 -g
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: woodard at redhat dot com
  Target Milestone: ---

One problem that I have run into over and over with developers that I support
is they think that -O0 will generate the easiest to debug code. I've been
trying to educate them to use -Og but the issue comes up over and over and over
again. 

I have two proposals which could help this problem and improve GCC's usability
and reduce the time that those of us who support developers must spend
educating people:

When the compiler flags include "-O0" and "-g" print out a warning along the
lines of: 
"GCC Warning: debug information will be degraded by the disabling all
optimization passes. Consider -Og instead."

However, many people never see warnings another proposal is when -O0 and -g are
both specified automatically assume -fvar-tracking -fvar-tracking-assignments
That would minimize the number of problems that people run into.

Either approach would be an improvement in GCC's usability and help avoid a
trap that far too many developers seem to fall into.

Reply via email to