https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65823

--- Comment #5 from vries at gcc dot gnu.org ---
--------------------------------------------
original dump:

{
  struct va_list aps[10];

    struct va_list aps[10];
  __builtin_va_start ((struct  &) (struct  *) &aps[4], i);
  x = VA_ARG_EXPR <aps[4]>;
  __builtin_va_end ((struct  &) (struct  *) &aps[4]);
}

------------------------------------
gimplify dump:

f3 (int i)
{
  long intD.5 x.0D.4231;
  struct va_listD.4222 apsD.4227[10];

  try
    {
      # USE = anything
      # CLB = anything
      __builtin_va_startD.1052 (&apsD.4227[4], 0);
      # USE = anything
      # CLB = anything
      x.0D.4231 = VA_ARG (&apsD.4227[4], 0B);
      apsD.4227[4] = apsD.4227[4];
      xD.4223 = x.0D.4231;
      # USE = anything
      # CLB = anything
      __builtin_va_endD.1051 (&apsD.4227[4]);
    }
  finally
    {
      apsD.4227 = {CLOBBER};
    }
}
------------------------------------

The nop introduced during gimplification is not meant to be there. This patch
gets rid of it:
...
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 0a8ef84..c68bd47 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -4792,7 +4792,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p,
gimple_seq *post_p,
   if (ap != NULL_TREE
       && TREE_CODE (ap) == ADDR_EXPR
       && TREE_CODE (ap_copy) == ADDR_EXPR
-      && TREE_OPERAND (ap, 0) != TREE_OPERAND (ap_copy, 0))
+      && !operand_equal_p (TREE_OPERAND (ap, 0), TREE_OPERAND (ap_copy, 0),
0))
     gimplify_assign (TREE_OPERAND (ap, 0), TREE_OPERAND (ap_copy, 0), pre_p);

   if (want_value)
...

Reply via email to