re PR middle-end/58809 (ICE with complex variable in OpenMP reduction clause)
authorMarek Polacek <polacek@redhat.com>
Mon, 21 Oct 2013 18:40:34 +0000 (18:40 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 21 Oct 2013 18:40:34 +0000 (18:40 +0000)
PR middle-end/58809
* fold-const.c (fold_range_test): Return 0 if the type is not
an integral type.
testsuite/
* gcc.dg/gomp/pr58809.c: New test.

From-SVN: r203907

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/gomp/pr58809.c [new file with mode: 0644]

index e34ff7bd92f1f9c1fd449727098b428f3ae9f366..d00105df9fbaecbb8d76bc45841a0e52bcf3a77d 100644 (file)
@@ -1,3 +1,9 @@
+2013-10-21  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/58809
+       * fold-const.c (fold_range_test): Return 0 if the type is not
+       an integral type.
+
 2013-10-21  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * system.h: Move hwint.h include further down.
index 2c2b929d6e296d4d4f23508e70c773bbbd86ab64..021d670acf0744359418effcfa093f626bcd812c 100644 (file)
@@ -4970,12 +4970,16 @@ fold_range_test (location_t loc, enum tree_code code, tree type,
   int in0_p, in1_p, in_p;
   tree low0, low1, low, high0, high1, high;
   bool strict_overflow_p = false;
-  tree lhs = make_range (op0, &in0_p, &low0, &high0, &strict_overflow_p);
-  tree rhs = make_range (op1, &in1_p, &low1, &high1, &strict_overflow_p);
-  tree tem;
+  tree tem, lhs, rhs;
   const char * const warnmsg = G_("assuming signed overflow does not occur "
                                  "when simplifying range test");
 
+  if (!INTEGRAL_TYPE_P (type))
+    return 0;
+
+  lhs = make_range (op0, &in0_p, &low0, &high0, &strict_overflow_p);
+  rhs = make_range (op1, &in1_p, &low1, &high1, &strict_overflow_p);
+
   /* If this is an OR operation, invert both sides; we will invert
      again at the end.  */
   if (or_op)
index b9926c8f3f3222a6d700f9104f30ae9912b07659..fca2bb4b1ac024937bd80e5294df748ba0296526 100644 (file)
@@ -1,3 +1,8 @@
+2013-10-21  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/58809
+       * gcc.dg/gomp/pr58809.c: New test.
+
 2013-10-21  Vidya Praveen  <vidyapraveen@arm.com>
 
        * gcc.dg/20050922-1.c: Remove stdlib.h and declare abort().
diff --git a/gcc/testsuite/gcc.dg/gomp/pr58809.c b/gcc/testsuite/gcc.dg/gomp/pr58809.c
new file mode 100644 (file)
index 0000000..5dc02f6
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR middle-end/58809 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -O" } */
+
+int i;
+#pragma omp threadprivate (i)
+
+void foo()
+{
+  _Complex int j;
+#pragma omp parallel copyin (i) reduction (&&:j)
+  ;
+}