https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112741
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|unassigned at gcc dot gnu.org |rguenth at gcc dot gnu.org Ever confirmed|0 |1 Last reconfirmed| |2023-11-28 Status|UNCONFIRMED |ASSIGNED --- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. The gimplifier asserts here: 3267 /* ??? If this is a local variable, and it has not been seen in any 3268 outer BIND_EXPR, then it's probably the result of a duplicate 3269 declaration, for which we've already issued an error. It would 3270 be really nice if the front end wouldn't leak these at all. 3271 Currently the only known culprit is C++ destructors, as seen 3272 in g++.old-deja/g++.jason/binding.C. 3273 Another possible culpit are size expressions for variably modified 3274 types which are lost in the FE or not gimplified correctly. */ 3275 if (VAR_P (decl) 3276 && !DECL_SEEN_IN_BIND_EXPR_P (decl) 3277 && !TREE_STATIC (decl) && !DECL_EXTERNAL (decl) 3278 && decl_function_context (decl) == current_function_decl) 3279 { 3280 gcc_assert (seen_error ()); 3281 return GS_ERROR; 3282 } as we gimplify '((unsigned long) &c[0][j_2(D)][0] - (unsigned long) &c) + 4' during instrument_object_size. The GIMPLE frontend, when bypassing gimplification, doesn't set DECL_SEEN_IN_BIND_EXPR_P given there are no such things in GIMPLE. But it probably should set the flag anyway. Testing a patch.