This bug happens because GIMPLE_TRANSACTION is a statement
without real but with virtual operands.  The short-cut in gimple_copy
thus is overly optimistic.  Fixed as follows.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Richard.

2012-09-21  Richard Guenther  <rguent...@suse.de>

        PR middle-end/52173
        * gimple.c (gimple_copy): Properly mark the copy modified
        if SSA operands are present.

Index: gcc/gimple.c
===================================================================
*** gcc/gimple.c        (revision 191613)
--- gcc/gimple.c        (working copy)
*************** gimple_copy (gimple stmt)
*** 2333,2355 ****
      }
  
    /* Make copy of operands.  */
!   if (num_ops > 0)
!     {
!       for (i = 0; i < num_ops; i++)
!       gimple_set_op (copy, i, unshare_expr (gimple_op (stmt, i)));
  
!       /* Clear out SSA operand vectors on COPY.  */
!       if (gimple_has_ops (stmt))
!       {
!         gimple_set_def_ops (copy, NULL);
!         gimple_set_use_ops (copy, NULL);
!       }
  
!       if (gimple_has_mem_ops (stmt))
!       {
!         gimple_set_vdef (copy, gimple_vdef (stmt));
!         gimple_set_vuse (copy, gimple_vuse (stmt));
!       }
  
        /* SSA operands need to be updated.  */
        gimple_set_modified (copy, true);
--- 2333,2352 ----
      }
  
    /* Make copy of operands.  */
!   for (i = 0; i < num_ops; i++)
!     gimple_set_op (copy, i, unshare_expr (gimple_op (stmt, i)));
  
!   if (gimple_has_mem_ops (stmt))
!     {
!       gimple_set_vdef (copy, gimple_vdef (stmt));
!       gimple_set_vuse (copy, gimple_vuse (stmt));
!     }
  
!   /* Clear out SSA operand vectors on COPY.  */
!   if (gimple_has_ops (stmt))
!     {
!       gimple_set_def_ops (copy, NULL);
!       gimple_set_use_ops (copy, NULL);
  
        /* SSA operands need to be updated.  */
        gimple_set_modified (copy, true);

Reply via email to