re PR tree-optimization/35429 (ICE with complex arithmetic)
authorAndrew Pinski <pinskia@gmail.com>
Thu, 27 Mar 2008 08:55:50 +0000 (01:55 -0700)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Thu, 27 Mar 2008 08:55:50 +0000 (01:55 -0700)
2008-03-27  Andrew Pinski  <pinskia@gmail.com>

        PR middle-end/35429
        * fold-const.c (fold_truthop): Check for integeral types when folding
        a == 0 && b == 0 and a != 0 || b != 0 .

2008-03-27  Andrew Pinski  <pinskia@gmail.com>

        PR middle-end/35429
        * gcc.c-torture/compile/complex-5.c: New test.

From-SVN: r133631

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/complex-5.c [new file with mode: 0644]

index f62d553bba29972131c8b81eade3014ca1d1c311..8eca39fde41dafa74cde1b76dbedd1f16a616c85 100644 (file)
@@ -1,3 +1,9 @@
+2008-03-27  Andrew Pinski  <pinskia@gmail.com>
+
+       PR middle-end/35429
+       * fold-const.c (fold_truthop): Check for integeral types when folding
+       a == 0 && b == 0 and a != 0 || b != 0 .
+
 2008-03-26  Eric Botcazou  <ebotcazou@adacore.com>
 
        * tree.c (get_unwidened): Remove code fiddling with COMPONENT_REF.
index 3bfe52e0081f1eeee75e08cfe192b7222dacf8ab..896a9838e142af5f8863af3fc153f655f3f08942 100644 (file)
@@ -5357,7 +5357,8 @@ fold_truthop (enum tree_code code, tree truth_type, tree lhs, tree rhs)
       if (code == TRUTH_OR_EXPR
          && lcode == NE_EXPR && integer_zerop (lr_arg)
          && rcode == NE_EXPR && integer_zerop (rr_arg)
-         && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg))
+         && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg)
+         && INTEGRAL_TYPE_P (TREE_TYPE (ll_arg)))
        return build2 (NE_EXPR, truth_type,
                       build2 (BIT_IOR_EXPR, TREE_TYPE (ll_arg),
                               ll_arg, rl_arg),
@@ -5367,7 +5368,8 @@ fold_truthop (enum tree_code code, tree truth_type, tree lhs, tree rhs)
       if (code == TRUTH_AND_EXPR
          && lcode == EQ_EXPR && integer_zerop (lr_arg)
          && rcode == EQ_EXPR && integer_zerop (rr_arg)
-         && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg))
+         && TREE_TYPE (ll_arg) == TREE_TYPE (rl_arg)
+         && INTEGRAL_TYPE_P (TREE_TYPE (ll_arg)))
        return build2 (EQ_EXPR, truth_type,
                       build2 (BIT_IOR_EXPR, TREE_TYPE (ll_arg),
                               ll_arg, rl_arg),
index 55916d14f9d01da2a4c818f74ea44e4b22edfc80..e7f0cbe0608e25e25505df2d1e2ff295b80ed800 100644 (file)
@@ -1,3 +1,8 @@
+2008-03-27  Andrew Pinski  <pinskia@gmail.com>
+
+       PR middle-end/35429
+       * gcc.c-torture/compile/complex-5.c: New test.
+
 2008-03-26  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gcc.dg/uninit-16.c (decode_reloc): Mark static.
diff --git a/gcc/testsuite/gcc.c-torture/compile/complex-5.c b/gcc/testsuite/gcc.c-torture/compile/complex-5.c
new file mode 100644 (file)
index 0000000..59ddf68
--- /dev/null
@@ -0,0 +1,9 @@
+int foo(__complex__ int z0, __complex__ int z1)
+{
+  return z0 != 0 || z1 != 0;
+}
+
+int foo1(__complex__ int z0, __complex__ int z1)
+{
+  return z0 == 0 && z1 == 0;
+}