]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
d: Fix infinite loop in dump_generic_node [PR123264]
authorIain Buclaw <ibuclaw@gdcproject.org>
Thu, 29 Jan 2026 17:07:57 +0000 (18:07 +0100)
committerIain Buclaw <ibuclaw@gdcproject.org>
Fri, 30 Jan 2026 06:30:39 +0000 (07:30 +0100)
PR d/123264

gcc/d/ChangeLog:

* types.cc (finish_aggregate_type): Propagate struct TYPE_NAME to all
TYPE_NEXT_VARIANT types.

gcc/testsuite/ChangeLog:

* gdc.dg/pr123264.d: New test.

gcc/d/types.cc
gcc/testsuite/gdc.dg/pr123264.d [new file with mode: 0644]

index b09c262fc86f1f5c4fd2bfd229cc2cdc51adae31..078ac4c9e9b5ecfe5001d83d758f9d54f9521d09 100644 (file)
@@ -707,6 +707,7 @@ finish_aggregate_type (unsigned structsize, unsigned alignsize, tree type)
       if (t == type)
        continue;
 
+      TYPE_NAME (t) = TYPE_NAME (type);
       TYPE_FIELDS (t) = TYPE_FIELDS (type);
       TYPE_LANG_SPECIFIC (t) = TYPE_LANG_SPECIFIC (type);
       TYPE_SIZE (t) = TYPE_SIZE (type);
diff --git a/gcc/testsuite/gdc.dg/pr123264.d b/gcc/testsuite/gdc.dg/pr123264.d
new file mode 100644 (file)
index 0000000..a786c05
--- /dev/null
@@ -0,0 +1,8 @@
+// { dg-do compile }
+// { dg-options "-fdump-tree-original" }
+struct S123264
+{
+    void infinite(const S123264) { }
+    auto fn = &infinite;
+}
+// { dg-final { scan-tree-dump "const struct S123264" "original" } }