https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80136
--- Comment #10 from Bill Schmidt <wschmidt at gcc dot gnu.org> ---
Note that force_gimple_operand would do the gimplify_and_add for expr under
some circumstances:
if (TREE_CODE (expr) != MODIFY_EXPR
&& TREE_TYPE (expr) == void_type_node)
{
gimplify_and_add (expr, stmts);
expr = NULL_TREE;
}
else
{
ret = gimplify_expr (&expr, stmts, NULL, gimple_test_f, fb_rvalue);
gcc_assert (ret != GS_ERROR);
}
but because the MEM_EXPR has non-void type, it goes down the more complex path
and eventually runs into trouble.
The call to force_gimple_operand is almost redundant if we call
gimplify_and_add first, but it does do the extra check is_gimple_reg_rhs and
attempt to make a proper rvalue out of it if that fails. I'm not convinced
that can happen, but maybe. Just the gimplify_and_add works for this
particular case.