On Fri, Jan 16, 2026 at 11:17 AM Frank Ch. Eigler <[email protected]> wrote:

> Hi -
>
> > > That sounds like a quality of implementation issue.  Higher quality
> > > compilers accurately note the location of parameters, as they change
> > > within and after the prologue and other points in the function.  It
> > > is a location LIST after all.
> >
> > Ish. Certainly it's possible to do that - do you have pointers to any
> > compilers that do that? My experience with GCC and Clang at least has
> been
> > that there's (perhaps an undocumented) understanding that the locations
> are
> > only considered to be valid after the prologue/before the epilogue, and
> so
> > it's more efficient in terms of DWARF disk space to only describe that
> area.
>
> That experience may be dated somewhat. :-) GCC has been doing its best
> to produce detailed location lists throughout the function for many
> years.  Yeah it bloats location lists.  Try CFLAGS="-g -O2"; look up
> the history of CFLAGS=-fvar-tracking-assignments.
>

Ah, I was thinking more of an -O0 build, for instance - where GCC doesn't
produce a location that's valid in the prologue:
https://godbolt.org/z/4z84cdsMK
Not sure of a great way to get GCC to still produce a prologue even in an
optimized situation, but there's probably some way & that'd be interesting
to see what it produces for locations. But, sure, as you say, potentially
"quality of implementation" (more "difference in goals of implementation"
might be the case).

I'd just say - my experience is that compilers aren't trying to meet the
needs of describing the ABI in DWARF - so if that's what you're looking
for, I think you'll be fighting an uphill battle.
-- 
Dwarf-discuss mailing list
[email protected]
https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss

Reply via email to