]> git.ipfire.org Git - thirdparty/gcc.git/commit
d: Fix internal compiler error: in visit, at d/decl.cc:838 [PR119799]
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 15 Apr 2025 13:19:13 +0000 (15:19 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Tue, 15 Apr 2025 13:26:58 +0000 (15:26 +0200)
commit074b2b0f91f948fe3488ada91ec6a8576c684dea
treef4b62f4f05237b833cdf583fff763b2c19b10100
parent369461d0749790f1291f76096064d583d2547934
d: Fix internal compiler error: in visit, at d/decl.cc:838 [PR119799]

This was caused by a check in the D front-end disallowing static
VAR_DECLs with a size `0'.

While empty structs in D are give the size `1', the same symbol coming
from ImportC modules do infact have no size, so allow C variables to
pass the check as well as array objects.

PR d/119799

gcc/d/ChangeLog:

* decl.cc (DeclVisitor::visit (VarDeclaration *)): Check front-end
type size before building the VAR_DECL.  Allow C symbols to have a
size of `0'.

gcc/testsuite/ChangeLog:

* gdc.dg/import-c/pr119799.d: New test.
* gdc.dg/import-c/pr119799c.c: New test.
gcc/d/decl.cc
gcc/testsuite/gdc.dg/import-c/pr119799.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/import-c/pr119799c.c [new file with mode: 0644]