https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56961
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> --- I think this is another manifestation of the issue discussed in cp-gimplify.c: /* Remove any copies of empty classes. We check that the RHS has a simple form so that TARGET_EXPRs and non-empty CONSTRUCTORs get reduced properly, and we leave the return slot optimization alone because it isn't a copy (FIXME so it shouldn't be represented as one). Also drop volatile variables on the RHS to avoid infinite recursion from gimplify_expr trying to load the value. */ note that it happens only when struct foo is empty...