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

--- Comment #4 from Alexey Neyman <stilor at att dot net> ---
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.

Reply via email to