d: Fix ICE in gimplify_expr, at gimplify.c (PR98277)
authorIain Buclaw <ibuclaw@gdcproject.org>
Tue, 15 Dec 2020 09:36:00 +0000 (10:36 +0100)
committerIain Buclaw <ibuclaw@gdcproject.org>
Tue, 15 Dec 2020 21:20:35 +0000 (22:20 +0100)
commit36c9a3fe3f3c200ad3937d00d339b7269cf07adb
treeabd2c0a815ceee858b2a12f257ff6daec547af4d
parent34c7d3d3b216d674192678443bcfd379ec575d9f
d: Fix ICE in gimplify_expr, at gimplify.c (PR98277)

The DMD front-end shouldn't, but can sometimes leak manifest constants
in the AST passed to the code generator.  To prevent this being an
issue, the setting of DECL_INITIAL has been moved to the point where the
CONST_DECL is used, rather than in the declaration handler.

gcc/d/ChangeLog:

PR d/98277
* decl.cc (DeclVisitor::visit (VarDeclaration *)): Move setting of
DECL_INITIAL for manifest constants to ...
(get_symbol_decl): ... here.

gcc/testsuite/ChangeLog:

PR d/98277
* gdc.dg/pr98277.d: New test.
gcc/d/decl.cc
gcc/testsuite/gdc.dg/pr98277.d [new file with mode: 0644]