[Bug c++/88256] [7/8/9/10 Regression] ICE: Segmentation fault (in make_ssa_name_fn) with VLA cast, C++ FE missing DECL_EXPRs

nathan at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri May 17 11:01:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88256

--- Comment #10 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
digging into the C++ FE's grokdeclarator shows this to be trickier than C.  C
has a global variable of the expression component currently being built.  it
hooks a COMPOUND_EXPR into there, in its own binding layer, when the grokking
context is TYPENAME.  C++ does not have such a mechanism.

We cant just push the typedecl into the current statement list for three
reasons

1) if we're in an initializer of a var decl, we'll push the typedecl /after/
the expression to which it refers.

2) if we're in a conditionally reached subexpression, we'll push the typedecl
into an unconditional region of code.

    thing = cond ? (VLA_TYPE)expr : NULL;

3) if a components of the VLA is modified by an earlier piece of the current
expression (i.e. comma operator), we'll push the typedecl before that
modification.

    thing = (X++, (VLA_TYPE[X])expr);

I also noticed that strip_typedefs reconstructs the outer array type in 90494,
but because the original isn't in the canonical hash, these get different
canonical_types.  That seems wrong.

I suspect we need to do something like:
(a) create the typedecls in grokdeclarator
(b) insert the decl_exprs during the gimplify walk

that'll also handle the non function-scope cases, which we completely ignore
right now.


More information about the Gcc-bugs mailing list