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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note one reason to omit the info might be that it should be available in the
debug information of the callee.  The following simple patch makes the
desired debug information appear at both -O0 -g and -O -g for foo but
not for bar (which is unused):

extern void foo (int);
extern void bar (int);

int main()
{
  foo (1);
}


diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index ea9a34bda6f..3e97c1f4b4e 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2989,7 +2989,7 @@ symbol_table::finalize_compilation_unit (void)
       /* Emit early debug for reachable functions, and by consequence,
         locally scoped symbols.  */
       struct cgraph_node *cnode;
-      FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (cnode)
+      FOR_EACH_FUNCTION/*_WITH_GIMPLE_BODY*/ (cnode)
        (*debug_hooks->early_global_decl) (cnode->decl);

       /* Clean up anything that needs cleaning up after initial debug


The effect on debug info size would need to be evaluated (I'll check
GCC itself for this).

Reply via email to