From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1873) id 71B653858C55; Sun, 3 Mar 2024 00:00:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 71B653858C55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709424048; bh=SSZxqjs67niVRmN9Z2V723nZl+A+IAFKcrvbImYzDFY=; h=From:To:Subject:Date:From; b=HHIWVgPfnTP2mUecE+kLubgmFeLjKmxl5FLrKAE/2uCRU3Rzc2pFBLguAE39kvQ3f zrimGXrBsn6GACkKQDIVamjgFF2VxjHaxr2sZX1B+bQRoekCpVeGX8DRhnyIHdkR/v 8fpHUnJZCXsvN/T1nnC54RRE1QoEgRK/i82zhZ9s= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Iain Buclaw To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-8398] d: Fix internal compiler error: in make_import, at d/imports.cc:48 [PR113125] X-Act-Checkin: gcc X-Git-Author: Iain Buclaw X-Git-Refname: refs/heads/releases/gcc-13 X-Git-Oldrev: 96e6576a1ba0080e70fef4a6f9cc3129fcf6f008 X-Git-Newrev: 341fa4d2340b21c322082fb5a7cad18a48b9eda7 Message-Id: <20240303000048.71B653858C55@sourceware.org> Date: Sun, 3 Mar 2024 00:00:48 +0000 (GMT) List-Id: https://gcc.gnu.org/g:341fa4d2340b21c322082fb5a7cad18a48b9eda7 commit r13-8398-g341fa4d2340b21c322082fb5a7cad18a48b9eda7 Author: Iain Buclaw 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. (cherry picked from commit b0efb1c35724e3332ee5993976efb98200c1a154) 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 f19779fec7d..05050f9edd0 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 00000000000..761e613b055 --- /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 00000000000..cb7300baa1a --- /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;