]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
debug/112718 - reset all type units with -ffat-lto-objects
authorRichard Biener <rguenther@suse.de>
Mon, 22 Jan 2024 14:42:59 +0000 (15:42 +0100)
committerRichard Biener <rguenther@suse.de>
Fri, 17 May 2024 09:33:30 +0000 (11:33 +0200)
When mixing -flto, -ffat-lto-objects and -fdebug-type-section we
fail to reset all type units after early output resulting in an
ICE when attempting to add then duplicate sibling attributes.

PR debug/112718
* dwarf2out.cc (dwarf2out_finish): Reset all type units
for the fat part of an LTO compile.

* gcc.dg/debug/pr112718.c: New testcase.

(cherry picked from commit 7218f5050cb7163edae331f54ca163248ab48bfa)

gcc/dwarf2out.cc
gcc/testsuite/gcc.dg/debug/pr112718.c [new file with mode: 0644]

index d14ec0261b6b54e6b5ec68b0af0bf5e5ff6dda90..cfe87cba4c4ce4ed2a999eade30920f177d7641a 100644 (file)
@@ -32162,24 +32162,12 @@ dwarf2out_finish (const char *filename)
       reset_dies (comp_unit_die ());
       for (limbo_die_node *node = cu_die_list; node; node = node->next)
        reset_dies (node->die);
-
-      hash_table<comdat_type_hasher> comdat_type_table (100);
       for (ctnode = comdat_type_list; ctnode != NULL; ctnode = ctnode->next)
        {
-         comdat_type_node **slot
-             = comdat_type_table.find_slot (ctnode, INSERT);
-
-         /* Don't reset types twice.  */
-         if (*slot != HTAB_EMPTY_ENTRY)
-           continue;
-
          /* Remove the pointer to the line table.  */
          remove_AT (ctnode->root_die, DW_AT_stmt_list);
-
          if (debug_info_level >= DINFO_LEVEL_TERSE)
            reset_dies (ctnode->root_die);
-
-         *slot = ctnode;
        }
 
       /* Reset die CU symbol so we don't output it twice.  */
diff --git a/gcc/testsuite/gcc.dg/debug/pr112718.c b/gcc/testsuite/gcc.dg/debug/pr112718.c
new file mode 100644 (file)
index 0000000..ff80ca5
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target lto } */
+/* { dg-options "-g -fdebug-types-section -flto -ffat-lto-objects" } */
+
+struct {
+  int h;
+  unsigned char data[20 + 24 * 6];
+} _EC_X9_62_PRIME_192V2;
+struct {
+  int h;
+  unsigned char data[20 + 24 * 6];
+} _EC_X9_62_PRIME_192V3;