Skip to content

Commit

Permalink
d: Fix internal compiler error: in make_import, at d/imports.cc:48 [P…
Browse files Browse the repository at this point in the history
…R113125]

Hi,

This patch fixes an ICE triggered in the D front-end.

The cause of the ICE was that TYPE_DECLs were only being generated for
structs with members, not opaque structs.

	PR d/113125

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

Regards,
Iain.
  • Loading branch information
ibuclaw authored and ouuleilei-bot committed Feb 12, 2024
1 parent c2d62cd commit 434dcbb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gcc/d/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,11 @@ class TypeVisitor : public Visitor
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.
Expand Down
2 changes: 2 additions & 0 deletions gcc/testsuite/gdc.dg/imports/pr113125.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module imports.pr113125;
struct S113125;
4 changes: 4 additions & 0 deletions gcc/testsuite/gdc.dg/pr113125.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// { dg-do compile }
// { dg-options "-I $srcdir/gdc.dg" }
module pr113125;
import imports.pr113125: S113125;

0 comments on commit 434dcbb

Please sign in to comment.