https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79232
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jsm28 at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- On the gimplifier side, this is caused by the PR17855 changes which look weird. We have COND_EXPR <cond, INDIRECT_REF <something>, INDIRECT_REF <somethingelse>> = whatever; (of course the question is if the FE should emit that and not INDIRECT_REF <COND_EXPR <cond, something, somethingelse>> = whatever), and there are 2 problems. Before the /* C99 code may assign to an array in a structure value of a conditional expression, and this has undefined behavior only on execution, so create a temporary if an lvalue is required. */ if (fallback == fb_lvalue) { *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p, false); mark_addressable (*expr_p); ret = GS_OK; } block for COND_EXPR we have *expr_p a MEM_REF with iftmp.0 as address, exactly what we need. Without the mark_addressable (not sure why that was ever needed) we would actually end up writing to a temporary variable (first store there the previous value of the MEM_REF, then again the value we want into the MEM_REF). But the mark_addressable, if *expr_p has gimple ref type, actually causes also invalid IL in addition to wrong-code. I've tried the struct-non-lval-2.c testcase and this code is not reached in that case (because fallback is just 0, not fb_lvalue). That said, even if we fix the gimplifier, we probably want to change the FE so that it actually makes it clear what the store does. For COND_EXPR without the COMPOUND_EXPR, the FE actually emits if (cond) { (&c)[d] = e; } else { a[d] = e; }, so we probably want to emit that too.