[Bug debug/96383] [8/9/10/11 Regression] Full ABI information missing from GCC compiled C

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jul 31 08:43:51 GMT 2020


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

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #13)
> (In reply to Eric Botcazou from comment #12)
> > > So with the attached 'updated patch' I see
> > > 
> > >                 === gnat tests ===
> > > 
> > > 
> > > Running target unix/
> > > FAIL: gnat.dg/debug11_pkg.adb scan-assembler-not foreign_imported_func
> > > FAIL: gnat.dg/debug9.adb scan-assembler-times \\\\(DIE \\\\(0x[a-f0-9]*\\\\)
> > > DW_
> > > TAG_type_unit\\\\) 0
> > > 
> > > where the first FAIL seems obvious from the name of 'foreign_imported_func'
> > > and the changed outcome is expected and OK?
> > 
> > The annoying thing is the discrepancy with the variable case; in other
> > words, the patch is undercutting gnat_write_global_declarations
> > (utils.c:5913).

Ah, indeed.

> So, for Ada, would you like to preserve current behavior rather than what
> Richard's patch does?
> If so, can't we have a langhook that decides that?
> I don't know much about Ada, but would think that having the prototypes even
> for functions defined in other shared libraries if they are called or
> referenced in the TU is useful even for Ada.

I think that we need that loop in cgraphunit.c at all shows that frontends
are not enough in control...  The middle-end cannot really make the best
decision on what declarations are worth emitting debug info for so what
Ada does looks best here and maybe other FEs should follow suit...

Note that Ada does this even when -fsyntax-only (if it supports that).

I don't remember exactly but I think we've chosen to emit function DIEs
during unit finalization instead of at rest_of_decl_compilation time
because of ordering issues (FEs call rest_of_decl_compilation very much
too often...).

The most simplistic langhook would be to ask the FE whether a specific
decl should get debug info (but we have DECL_IGNORED for this already ...?).


More information about the Gcc-bugs mailing list