c-decl.c
358 KB
-
Add a DECL_EXPR for VLA pointer casts (PR 84305) · d74641bd
This PR was about a case in which we ended up with a MULT_EXPR that was shared between an ungimplified VLA type and a pointer calculation. The SSA names used in the pointer calculation were later freed, but they were still there in the VLA, and caused an ICE when remapping the types during inlinling. The fix is to add a DECL_EXPR that forces the VLA type sizes to be gimplified too, but the tricky part is deciding where. As the comment in grokdeclarator says, we can't just add it to the statement list, since the size might only be conditionally evaluated. It might also end up being evaluated out of sequence. The patch gets around that by putting the DECL_EXPR in a BIND_EXPR and adding the BIND_EXPR to the list of things that need to be evaluated for the declarator. 2018-02-13 Richard Sandiford <richard.sandiford@linaro.org> gcc/c/ PR c/84305 * c-decl.c (grokdeclarator): Create an anonymous TYPE_DECL in PARM and TYPENAME contexts too, but attach it to a BIND_EXPR and include the BIND_EXPR in the list of things that need to be pre-evaluated. gcc/testsuite/ PR c/84305 * gcc.c-torture/compile/pr84305.c: New test. From-SVN: r257620
Richard Sandiford committed