Comment 10 for bug 305176

Revision history for this message
In , Rguenth (rguenth) wrote :

This "fixes" it:

*** gimplify.c (revision 108853)
--- gimplify.c (working copy)
*************** gimplify_expr (tree *expr_p, tree *pre_p
*** 4203,4210 ****
              break;
            }

! if (VOID_TYPE_P (TREE_TYPE (*expr_p))
! || fallback == fb_none)
            {
              /* Just strip a conversion to void (or in void context) and
                 try again. */
--- 4203,4211 ----
              break;
            }

! if ((VOID_TYPE_P (TREE_TYPE (*expr_p))
! || fallback == fb_none)
! && ! TREE_CODE (TREE_OPERAND (*expr_p, 0)) == CALL_EXPR)
            {
              /* Just strip a conversion to void (or in void context) and
                 try again. */

it makes the gimplifier output

main ()
{
  int D.1519;
  int D.1520;

  D.1519 = foo ();
  D.1520 = 0;
  return D.1520;
}

instead of (with the (void) cast removed):

main ()
{
  int D.1519;

  foo ();
  D.1519 = 0;
  return D.1519;
}

The question whether this is an appropriate fix or just my astonishing ability
to find ugly workarounds remains to be answered ;)