[Bug d/108842] Cannot use enum array with -fno-druntime
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 7 20:00:32 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108842
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Iain Buclaw
<ibuclaw@gcc.gnu.org>:
https://gcc.gnu.org/g:eef069fe8b22229509a783c9ecb2eb659df4f5ab
commit r11-10898-geef069fe8b22229509a783c9ecb2eb659df4f5ab
Author: Iain Buclaw <ibuclaw@gdcproject.org>
Date: Fri Jul 7 21:06:07 2023 +0200
d: Fix PR 108842: Cannot use enum array with -fno-druntime
Restrict the generating of CONST_DECLs for D manifest constants to just
scalars without pointers. It shouldn't happen that a reference to a
manifest constant has not been expanded within a function body during
codegen, but it has been found to occur in older versions of the D
front-end (PR98277), so if the decl of a non-scalar constant is
requested, just return its initializer as an expression.
PR d/108842
gcc/d/ChangeLog:
* decl.cc (DeclVisitor::visit (VarDeclaration *)): Only emit scalar
manifest constants.
(get_symbol_decl): Don't generate CONST_DECL for non-scalar
manifest
constants.
* imports.cc (ImportVisitor::visit (VarDeclaration *)): New method.
gcc/testsuite/ChangeLog:
* gdc.dg/pr98277.d: Add more tests.
* gdc.dg/pr108842.d: New test.
(cherry picked from commit f934c5753849f7c48c6a3abfcd73b8f6008e8371)
More information about the Gcc-bugs
mailing list