https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94273
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |rguenth at gcc dot gnu.org --- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Alexey Neyman from comment #4) > Or add a similar "return if debug level is terse" at the beginning of > `gen_type_die` - I didn't notice that in C++ it could also get called not > through the `add_type_attribute`: > > ``` > diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c > index 89e52a41508..b0f6680bd61 100644 > --- a/gcc/dwarf2out.c > +++ b/gcc/dwarf2out.c > @@ -25709,6 +25709,9 @@ gen_type_die_with_usage (tree type, dw_die_ref > context_die, > static void > gen_type_die (tree type, dw_die_ref context_die) > { > + if (debug_info_level <= DINFO_LEVEL_TERSE) > + return; > + > if (type != error_mark_node) > { > gen_type_die_with_usage (type, context_die, DINFO_USAGE_DIR_USE); > ``` > > I verified that it makes the attached test case compile successfully. But then the static var is improperly scoped in the debug info? IMHO it's better left out.