re PR middle-end/48591 (OpenMP ICE with atomics on __float128 in 32-bit only i686...
authorJakub Jelinek <jakub@redhat.com>
Wed, 13 Apr 2011 15:50:02 +0000 (17:50 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 13 Apr 2011 15:50:02 +0000 (17:50 +0200)
PR middle-end/48591
* omp-low.c (expand_omp_atomic_fetch_op): Return false if decl is
NULL.
(expand_omp_atomic_pipeline): Return false if cmpxchg is NULL.

* gcc.dg/gomp/pr48591.c: New test.

* testsuite/libgomp.c/pr48591.c: New test.

From-SVN: r172379

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/gomp/pr48591.c [new file with mode: 0644]
libgomp/ChangeLog
libgomp/testsuite/libgomp.c/pr48591.c [new file with mode: 0644]

index 4e3efc924c94a12d176b15ba00aef26a217ab3e1..ee201f84c6e01e8b3c346058a62d9922ef58f0b9 100644 (file)
@@ -1,3 +1,10 @@
+2011-04-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/48591
+       * omp-low.c (expand_omp_atomic_fetch_op): Return false if decl is
+       NULL.
+       (expand_omp_atomic_pipeline): Return false if cmpxchg is NULL.
+
 2011-04-13  Bernd Schmidt  <bernds@codesourcery.com>
 
        * dwarf2out.c (struct dw_cfi_struct): Remove member dw_cfi_next.
index 8b2412cca1a5931845753e8ae473ce539f19b914..bc7bf4a15e1cdf4c87f3fc0ed4abf6c518d13e3b 100644 (file)
@@ -5006,6 +5006,8 @@ expand_omp_atomic_fetch_op (basic_block load_bb,
     return false;
 
   decl = built_in_decls[base + index + 1];
+  if (decl == NULL_TREE)
+    return false;
   itype = TREE_TYPE (TREE_TYPE (decl));
 
   if (direct_optab_handler (optab, TYPE_MODE (itype)) == CODE_FOR_nothing)
@@ -5057,6 +5059,8 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
   edge e;
 
   cmpxchg = built_in_decls[BUILT_IN_VAL_COMPARE_AND_SWAP_N + index + 1];
+  if (cmpxchg == NULL_TREE)
+    return false;
   type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr)));
   itype = TREE_TYPE (TREE_TYPE (cmpxchg));
 
index 46ff86a1bfd7d26745aae176c86c072b4373fbab..e4e33fb2ba8facc200d881346ba93621198812bb 100644 (file)
@@ -1,5 +1,8 @@
 2011-04-13  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/48591
+       * gcc.dg/gomp/pr48591.c: New test.
+
        PR c++/48570
        * g++.dg/cpp0x/constexpr-wstring1.C: New test.
        * g++.dg/cpp0x/constexpr-wstring2.C: New test.
diff --git a/gcc/testsuite/gcc.dg/gomp/pr48591.c b/gcc/testsuite/gcc.dg/gomp/pr48591.c
new file mode 100644 (file)
index 0000000..e6cb106
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR middle-end/48591 */
+/* { dg-do compile { target i?86-*-* x86_64-*-* ia64-*-* } } */
+/* { dg-options "-fopenmp" } */
+
+extern void abort (void);
+
+int
+main ()
+{
+  __float128 f = 0.0;
+  int i;
+  #pragma omp parallel for reduction(+:f)
+    for (i = 0; i < 128; i++)
+      f += 0.5Q;
+  if (f != 64.0Q)
+    abort ();
+  #pragma omp atomic
+    f += 8.5Q;
+  if (f != 72.5Q)
+    abort ();
+  return 0;
+}
index 52ea1433548a835eb47d0bb0b8e65d428efd1c92..af2ad8e3cd8e41455de19a298d15f2b6f6fbe7e9 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/48591
+       * testsuite/libgomp.c/pr48591.c: New test.
+
 2011-03-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        PR bootstrap/48135
diff --git a/libgomp/testsuite/libgomp.c/pr48591.c b/libgomp/testsuite/libgomp.c/pr48591.c
new file mode 100644 (file)
index 0000000..18dfd7f
--- /dev/null
@@ -0,0 +1,22 @@
+/* PR middle-end/48591 */
+/* { dg-do run { target i?86-*-linux* x86_64-*-linux* ia64-*-linux* } } */
+/* { dg-options "-fopenmp" } */
+
+extern void abort (void);
+
+int
+main ()
+{
+  __float128 f = 0.0;
+  int i;
+  #pragma omp parallel for reduction(+:f)
+    for (i = 0; i < 128; i++)
+      f += 0.5Q;
+  if (f != 64.0Q)
+    abort ();
+  #pragma omp atomic
+    f += 8.5Q;
+  if (f != 72.5Q)
+    abort ();
+  return 0;
+}