re PR rtl-optimization/39588 (internal compiler error: in trunc_int_for_mode, at...
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 1 Apr 2009 20:46:30 +0000 (20:46 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 1 Apr 2009 20:46:30 +0000 (20:46 +0000)
PR rtl-optimization/39588
* combine.c (merge_outer_ops): Do not set the constant when this
is not necessary.
(simplify_shift_const_1): Do not modify it either in this case.

From-SVN: r145430

gcc/ChangeLog
gcc/combine.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/20090401-1.c [new file with mode: 0644]

index 04181d6572104ed43b33be53c92fca02cb9e48d0..b3b7d78dc804522ea83dc5ff9b1105246154c148 100644 (file)
@@ -1,3 +1,10 @@
+2009-04-01  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR rtl-optimization/39588
+       * combine.c (merge_outer_ops): Do not set the constant when this
+       is not necessary.
+       (simplify_shift_const_1): Do not modify it either in this case.
+
 2009-04-01  Steven Bosscher  <steven@gcc.gnu.org>
 
        * config/ia64/ia64.c (ia64_handle_option): Inform user that Itanium1
index 3ce8a75ca2f7044dec64648b78ca64182b84fcec..80187347aed44aa2a24e83829e2bac0cb6f06bf9 100644 (file)
@@ -8971,13 +8971,13 @@ merge_outer_ops (enum rtx_code *pop0, HOST_WIDE_INT *pconst0, enum rtx_code op1,
           && op0 == AND)
     op0 = UNKNOWN;
 
+  *pop0 = op0;
+
   /* ??? Slightly redundant with the above mask, but not entirely.
      Moving this above means we'd have to sign-extend the mode mask
      for the final test.  */
-  const0 = trunc_int_for_mode (const0, mode);
-
-  *pop0 = op0;
-  *pconst0 = const0;
+  if (op0 != UNKNOWN && op0 != NEG)
+    *pconst0 = trunc_int_for_mode (const0, mode);
 
   return 1;
 }
@@ -9700,7 +9700,8 @@ simplify_shift_const_1 (enum rtx_code code, enum machine_mode result_mode,
 
   if (outer_op != UNKNOWN)
     {
-      if (GET_MODE_BITSIZE (result_mode) < HOST_BITS_PER_WIDE_INT)
+      if (GET_RTX_CLASS (outer_op) != RTX_UNARY
+         && GET_MODE_BITSIZE (result_mode) < HOST_BITS_PER_WIDE_INT)
        outer_const = trunc_int_for_mode (outer_const, result_mode);
 
       if (outer_op == AND)
index b104b2ad59fc5c5008d0ee28039991b784bac00e..b61f69a82cd2f66e8243a38a86f80eed9914b838 100644 (file)
@@ -1,3 +1,7 @@
+2009-04-01  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc.c-torture/compile/20090401-1.c: New test.
+
 2009-04-01  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR c++/4926
diff --git a/gcc/testsuite/gcc.c-torture/compile/20090401-1.c b/gcc/testsuite/gcc.c-torture/compile/20090401-1.c
new file mode 100644 (file)
index 0000000..a0058fe
--- /dev/null
@@ -0,0 +1,11 @@
+/* PR rtl-optimization/39588 */
+/* Testcase by Olivier ROUSSEL <olivier.roussel@cril.univ-artois.fr> */
+
+#define lit_from_int(in) ((in<0)?(((-in)<<1)|1):(in<<1))
+
+void init_clause(int *literals, int size, int *lits)
+{
+  int i;
+  for(i=0; i < size; i++)
+    lits[i] = lit_from_int(literals[i]);
+}