https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107303
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, cp_build_modify_expr calls stabilize_expr on UNARY_PLUS_EXPR of a TARGET_EXPR. stabilize_expr wraps it into (another) TARGET_EXPR, puts the TARGET_EXPR as an initialization statement and returns the TARGET_EXPR_SLOT. With the TARGET_EXPR_SLOT being used in places other than the TARGET_EXPR_{SLOT,INITIAL} the r13-2978 change doesn't look correct, because it replaces the outer TARGET_EXPR with the inner one, but the slot of the outer might be used elsewhere. Now, maybe with the nested TARGET_EXPR case we never use the inner TARGET_EXPR's slot outside of the outer TARGET_EXPR, if that is the case, perhaps we could still do the optimization, but keep the outer TARGET_EXPR rather than inner, strip the inner TARGET_EXPR from outer TARGET_EXPR's initializer and replace all occurrences of the inner slot with the outer slot?