https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115426
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- I think this is a gimplification failure. 'r' is neither TREE_ADDRESSABLE nor DECL_NOT_GIMPLE_REG and the =X constraint results in both allow_reg and allow_mem but we gimplify it as is_gimple_lvalue which should, as the base is a gimple register, emit a component extract to pre_p and a complex build to post_p. gimplify_compound_lval correctly sees this and forces a register argument to the __imag operation but I'm not sure that's enough for lvalues. IIRC a simple __imag x = 1; also doesn't have DECL_NOT_GIMPLE_REG on 'x', and gimplify_compound_lval behaves the same. Still we eventually gimplify to _1 = REALPART_EXPR <x>; x = COMPLEX_EXPR <_1, 1.0e+0>; D.2772 = x; which is done via gimplify_modify_expr_complex_part. That suggests it's gimplify_asm_expr that would need to do this very same thing as we seem to rely on this for correctness. With "=r" we correctly gimplify to __asm__("" : "=r" D.2772); _1 = REALPART_EXPR <r>; r = COMPLEX_EXPR <_1, D.2772>; D.2773 = r;