public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] d: ICE in gimple_register_canonical_type_1, at lto/lto-common.c:430 (PR102094)
@ 2021-08-29 16:31 Iain Buclaw
  0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2021-08-29 16:31 UTC (permalink / raw)
  To: gcc-patches

Hi,

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.

Bootstrapped and regression tested on x86_64-linux-gnu/-m32/-mx32,
committed to mainline.

Regards,
Iain

---
gcc/d/ChangeLog:

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

gcc/testsuite/ChangeLog:

	PR d/102094
	* gdc.dg/lto/pr102094_0.d: New test.
---
 gcc/d/d-codegen.cc                    |  1 +
 gcc/testsuite/gdc.dg/lto/pr102094_0.d | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 gcc/testsuite/gdc.dg/lto/pr102094_0.d

diff --git a/gcc/d/d-codegen.cc b/gcc/d/d-codegen.cc
index fe2ad98e60a..ad20bd15403 100644
--- a/gcc/d/d-codegen.cc
+++ b/gcc/d/d-codegen.cc
@@ -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
index 00000000000..f83631a1158
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/lto/pr102094_0.d
@@ -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);
+    }
+}
-- 
2.30.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-29 16:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-29 16:31 [committed] d: ICE in gimple_register_canonical_type_1, at lto/lto-common.c:430 (PR102094) Iain Buclaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).