re PR rtl-optimization/36006 (invalid rtl sharing with -O2)
authorUros Bizjak <uros@gcc.gnu.org>
Thu, 24 Apr 2008 04:53:47 +0000 (06:53 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Thu, 24 Apr 2008 04:53:47 +0000 (06:53 +0200)
        PR rtl-optimization/36006
        * expmed.c (store_fixed_bit_field): Copy op0 rtx before moving
        temp to op0 in order to avoid invalid rtx sharing.

testsuite/ChangeLog:

        PR rtl-optimization/36006
        * gfortran.dg/pr36006-1.f90: New test.
        * gfortran.dg/pr36006-2.f90: Ditto.

From-SVN: r134618

gcc/ChangeLog
gcc/expmed.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/pr36006-1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/pr36006-2.f90 [new file with mode: 0644]

index cab2723422afc305a68f50426e21eef684ac550f..057c7dce215a5f8c776e15b113803c317250db7d 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-24  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR rtl-optimization/36006
+       * expmed.c (store_fixed_bit_field): Copy op0 rtx before moving
+       temp to op0 in order to avoid invalid rtx sharing.
+
 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
 
        * tree-cfg.c (verify_expr): Check with is_gimple_address.  Don't
 
 2008-04-22  Tomas Bily  <tbily@suse.cz>
 
-        * tree-cfg.c (verify_expr): Check for NON_LVALUE_EXPR as unreachable
-        case.
-
-        * tree-vrp.c (extract_range_from_unary_expr): Removed unused
-        NON_LVALUE_EXPR.
-
-        * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise.
-
-        * tree-ssa-structalias.c (get_constraint_for): Likewise.
-
-        * tree-inline.c (estimate_num_insns_1): Likewise.
-
-        * varasm.c (const_hash_1, compare_constant, copy_constant)
-        (compute_reloc_for_constant, output_addressed_constants): Likewise.
-
-        * emit-rtl.c (component_ref_for_mem_expr)
-        (set_mem_attributes_minus_bitpos): Likewise.
-
-        * expr.c (highest_pow2_factor, expand_expr_real_1, )
-        (is_aligning_offset): Likewise.
-
-        * dwarf2out.c (loc_descriptor_from_tree_1, add_bound_info): Likewise.
-
-        * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Likewise.
-
-        * dojump.c (do_jump): Likewise.
-
-        * builtins.c (get_pointer_alignment, get_memory_rtx)
-        (integer_valued_real_p, fold_builtin_next_arg): Likewise.
-
-        * tree-scalar-evolution.c (instantiate_parameters_1): Likewise.
+       * tree-cfg.c (verify_expr): Check for NON_LVALUE_EXPR as
+       unreachable case.
+       * tree-vrp.c (extract_range_from_unary_expr): Removed unused
+       NON_LVALUE_EXPR.
+       * tree-ssa-threadedge.c (simplify_control_stmt_condition): Likewise.
+       * tree-ssa-structalias.c (get_constraint_for): Likewise.
+       * tree-inline.c (estimate_num_insns_1): Likewise.
+       * varasm.c (const_hash_1, compare_constant, copy_constant)
+       (compute_reloc_for_constant, output_addressed_constants): Likewise.
+       * emit-rtl.c (component_ref_for_mem_expr)
+       (set_mem_attributes_minus_bitpos): Likewise.
+       * expr.c (highest_pow2_factor, expand_expr_real_1, )
+       (is_aligning_offset): Likewise.
+       * dwarf2out.c (loc_descriptor_from_tree_1, add_bound_info): Likewise.
+       * tree-ssa-loop-ivopts.c (may_be_nonaddressable_p): Likewise.
+       * dojump.c (do_jump): Likewise.
+       * builtins.c (get_pointer_alignment, get_memory_rtx)
+       (integer_valued_real_p, fold_builtin_next_arg): Likewise.
+       * tree-scalar-evolution.c (instantiate_parameters_1): Likewise.
 
 2008-04-23  Jakub Jelinek  <jakub@redhat.com>
 
        df_entry_block_defs_collect, df_exit_block_uses_collect):
        Added mode parameter to calls to df_ref_record, df_uses_record,
        df_ref_create_structure.
-               (df_ref_equal_p, df_ref_compare): Added test for modes.
+       (df_ref_equal_p, df_ref_compare): Added test for modes.
        (df_ref_create_structure): Added code to set mode.  Renamed
        DF_REF_WIDTH and DF_REF_OFFSET to DF_REF_EXTRACT_WIDTH and
        DF_REF_EXTRACT_OFFSET.
index d5d2d528ca0a4d489231c91217442392cb825583..5268b318f8dc6537cc91c150aec70a356cef1095 100644 (file)
@@ -976,7 +976,10 @@ store_fixed_bit_field (rtx op0, unsigned HOST_WIDE_INT offset,
     }
 
   if (op0 != temp)
-    emit_move_insn (op0, temp);
+    {
+      op0 = copy_rtx (op0);
+      emit_move_insn (op0, temp);
+    }
 }
 \f
 /* Store a bit field that is split across multiple accessible memory objects.
index b73ce752a8b429e5f1a76801b1d210fc5299da27..a11dc7aefa9a182b861d3e5e80085f9a700bbac9 100644 (file)
@@ -1,3 +1,9 @@
+2008-04-24  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+
+       PR rtl-optimization/36006
+       * gfortran.dg/pr36006-1.f90: New test.
+       * gfortran.dg/pr36006-2.f90: Ditto.
+
 2008-04-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/35994
diff --git a/gcc/testsuite/gfortran.dg/pr36006-1.f90 b/gcc/testsuite/gfortran.dg/pr36006-1.f90
new file mode 100644 (file)
index 0000000..ad33d94
--- /dev/null
@@ -0,0 +1,23 @@
+! { dg-do compile }
+!
+subroutine test4
+  integer, parameter :: wp = 4
+  complex(wp), parameter :: i = (0._wp, 1._wp)
+  complex(wp) :: c(12)
+  integer :: m, N
+
+  N = 12
+  c = (/(exp(i*m),m=1,N)/)
+  print *, c(1)
+end
+
+subroutine test8
+  integer, parameter :: wp = 8
+  complex(wp), parameter :: i = (0._wp, 1._wp)
+  complex(wp) :: c(12)
+  integer :: m, N
+
+  N = 12
+  c = (/(exp(i*m),m=1,N)/)
+  print *, c(1)
+end
diff --git a/gcc/testsuite/gfortran.dg/pr36006-2.f90 b/gcc/testsuite/gfortran.dg/pr36006-2.f90
new file mode 100644 (file)
index 0000000..f422e09
--- /dev/null
@@ -0,0 +1,13 @@
+! { dg-do compile }
+! { dg-require-effective-target fortran_large_real }
+!
+subroutine test_large
+  integer, parameter :: wp = selected_real_kind (precision (0.0_8) + 1)
+  complex(wp), parameter :: i = (0._wp, 1._wp)
+  complex(wp) :: c(12)
+  integer :: m, N
+
+  N = 12
+  c = (/(exp(i*m),m=1,N)/)
+  print *, c(1)
+end