]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
d: ICE in gimple_register_canonical_type_1, at lto/lto-common.c:430 (PR102094)
authorIain Buclaw <ibuclaw@gdcproject.org>
Sat, 28 Aug 2021 14:57:03 +0000 (16:57 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Sun, 29 Aug 2021 15:19:02 +0000 (17:19 +0200)
User defined types have the TYPE_CXX_ODR_P flag set, but closure frames
did not.  This mismatch led to an ICE in the conflict detection for ODR
and interoperable non-ODR types.  As a given closure frame is tied
explicitly to a function, it already conforms to ODR.

PR d/102094

gcc/d/ChangeLog:

* d-codegen.cc (build_frame_type): Set TYPE_CXX_ODR_P.

gcc/testsuite/ChangeLog:

* gdc.dg/lto/pr102094_0.d: New test.

gcc/d/d-codegen.cc
gcc/testsuite/gdc.dg/lto/pr102094_0.d [new file with mode: 0644]

index fe2ad98e60ae8ecbe8c9fcfef0be9506700ff0b8..ad20bd154030df33b11cbec3330ebf44cf5d8a3f 100644 (file)
@@ -2563,6 +2563,7 @@ build_frame_type (tree ffi, FuncDeclaration *fd)
 
   TYPE_FIELDS (frame_rec_type) = fields;
   TYPE_READONLY (frame_rec_type) = 1;
+  TYPE_CXX_ODR_P (frame_rec_type) = 1;
   layout_type (frame_rec_type);
   d_keep (frame_rec_type);
 
diff --git a/gcc/testsuite/gdc.dg/lto/pr102094_0.d b/gcc/testsuite/gdc.dg/lto/pr102094_0.d
new file mode 100644 (file)
index 0000000..f83631a
--- /dev/null
@@ -0,0 +1,18 @@
+// { dg-lto-do link }
+module pr102094_0;
+
+extern(C) int printf(char* s, ...);
+
+struct S102094
+{
+    int a;
+}
+
+void main()
+{
+    S102094 x;
+    void nested()
+    {
+        printf(cast(char*)0, x);
+    }
+}