public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-8935] d: Fix internal compiler error: in make_import, at d/imports.cc:48 [PR113125]
Date: Mon, 12 Feb 2024 16:08:39 +0000 (GMT)	[thread overview]
Message-ID: <20240212160839.879683858415@sourceware.org> (raw)

https://gcc.gnu.org/g:b0efb1c35724e3332ee5993976efb98200c1a154

commit r14-8935-gb0efb1c35724e3332ee5993976efb98200c1a154
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date:   Mon Feb 12 16:59:12 2024 +0100

    d: Fix internal compiler error: in make_import, at d/imports.cc:48 [PR113125]
    
    The cause of the ICE was that TYPE_DECLs were only being generated for
    structs with members, not opaque structs.
    
            PR d/113125
    
    gcc/d/ChangeLog:
    
            * types.cc (TypeVisitor::visit (TypeStruct *)): Generate TYPE_DECL and
            apply UDAs to opaque struct declarations.
    
    gcc/testsuite/ChangeLog:
    
            * gdc.dg/imports/pr113125.d: New test.
            * gdc.dg/pr113125.d: New test.

Diff:
---
 gcc/d/types.cc                          | 5 +++++
 gcc/testsuite/gdc.dg/imports/pr113125.d | 2 ++
 gcc/testsuite/gdc.dg/pr113125.d         | 4 ++++
 3 files changed, 11 insertions(+)

diff --git a/gcc/d/types.cc b/gcc/d/types.cc
index af9aad8a4123..ed97aa39cc54 100644
--- a/gcc/d/types.cc
+++ b/gcc/d/types.cc
@@ -1230,6 +1230,11 @@ public:
 	apply_user_attributes (t->sym, t->ctype);
 	finish_aggregate_type (structsize, alignsize, t->ctype);
       }
+    else
+      {
+	build_type_decl (t->ctype, t->sym);
+	apply_user_attributes (t->sym, t->ctype);
+      }
 
     /* For structs with a user defined postblit, copy constructor, or a
        destructor, also set TREE_ADDRESSABLE on the type and all variants.
diff --git a/gcc/testsuite/gdc.dg/imports/pr113125.d b/gcc/testsuite/gdc.dg/imports/pr113125.d
new file mode 100644
index 000000000000..761e613b0552
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/imports/pr113125.d
@@ -0,0 +1,2 @@
+module imports.pr113125;
+struct S113125;
diff --git a/gcc/testsuite/gdc.dg/pr113125.d b/gcc/testsuite/gdc.dg/pr113125.d
new file mode 100644
index 000000000000..cb7300baa1ad
--- /dev/null
+++ b/gcc/testsuite/gdc.dg/pr113125.d
@@ -0,0 +1,4 @@
+// { dg-do compile }
+// { dg-options "-I $srcdir/gdc.dg" }
+module pr113125;
+import imports.pr113125: S113125;

                 reply	other threads:[~2024-02-12 16:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240212160839.879683858415@sourceware.org \
    --to=ibuclaw@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).