public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/102523] New: Assume -fvar-tracking -fvar-tracking-assignments when compiling with -O0 -g
@ 2021-09-28 20:04 woodard at redhat dot com
  2021-09-28 20:11 ` [Bug debug/102523] " pinskia at gcc dot gnu.org
  2021-09-28 20:41 ` jakub at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: woodard at redhat dot com @ 2021-09-28 20:04 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug debug/102523] Assume -fvar-tracking -fvar-tracking-assignments when compiling with -O0 -g
  2021-09-28 20:04 [Bug debug/102523] New: Assume -fvar-tracking -fvar-tracking-assignments when compiling with -O0 -g woodard at redhat dot com
@ 2021-09-28 20:11 ` pinskia at gcc dot gnu.org
  2021-09-28 20:41 ` jakub at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-09-28 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=62225

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Short answer is fvar-tracking still does not work with -O0; I highly doubt this
has changed since 2014 really.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug debug/102523] Assume -fvar-tracking -fvar-tracking-assignments when compiling with -O0 -g
  2021-09-28 20:04 [Bug debug/102523] New: Assume -fvar-tracking -fvar-tracking-assignments when compiling with -O0 -g woodard at redhat dot com
  2021-09-28 20:11 ` [Bug debug/102523] " pinskia at gcc dot gnu.org
@ 2021-09-28 20:41 ` jakub at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-09-28 20:41 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This can't be done.  -O0's main objective is fast compile time, -fvar-tracking*
is very expensive compile time.
What we want is instead a special var-tracking mode that would track only what
is necessary for -O0 where most of the variables live in memory.
In particular, one needs to track variables with register keyword (those aren't
pinned into memory), probably passing of parameters and return values in the
prologue and epilogue and probably VLA dimensions in some cases.
Note, -Og, while it does var-tracking and generally attempts to disable many
optimizations that could hurt debuggability unfortunately doesn't add
artificial uses of all vars at the end of their scope and so sometimes -O0 -g
is debuggable much better than -Og -g, sometimes the other way around.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-28 20:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-28 20:04 [Bug debug/102523] New: Assume -fvar-tracking -fvar-tracking-assignments when compiling with -O0 -g woodard at redhat dot com
2021-09-28 20:11 ` [Bug debug/102523] " pinskia at gcc dot gnu.org
2021-09-28 20:41 ` jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).