https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110737
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- build_atomic_assign does not handle this in a reasonable fashion. Note there is code like : if (modifycode != NOP_EXPR) add_stmt (rhs); /* NOP_EXPR indicates it's a straight store of the RHS. Simply issue an atomic_store. */ if (modifycode == NOP_EXPR) { ... /* VAL is the value which was stored, return a COMPOUND_STMT of the statement and that value. */ return build2 (COMPOUND_EXPR, nonatomic_lhs_type, compound_stmt, val); } Which definitely could be improved too.