public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3206] 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-cvs

https://gcc.gnu.org/g:07984707be4eb9aea55dafbbc796790b8b8ac700

commit r12-3206-g07984707be4eb9aea55dafbbc796790b8b8ac700
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Sat Aug 28 16:57:03 2021 +0200

    d: ICE in gimple_register_canonical_type_1, at lto/lto-common.c:430 (PR102094)
    
    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.

Diff:
---
 gcc/d/d-codegen.cc                    |  1 +
 gcc/testsuite/gdc.dg/lto/pr102094_0.d | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

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);
+    }
+}


^ 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 [gcc r12-3206] 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).