From: Jakub Jelinek Date: Wed, 13 Apr 2011 15:50:02 +0000 (+0200) Subject: re PR middle-end/48591 (OpenMP ICE with atomics on __float128 in 32-bit only i686... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=20790697dd24387ffbf4f97e46774edfcb0a7142;p=gcc.git re PR middle-end/48591 (OpenMP ICE with atomics on __float128 in 32-bit only i686 cc1) 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4e3efc924c9..ee201f84c6e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-04-13 Jakub Jelinek + + 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 * dwarf2out.c (struct dw_cfi_struct): Remove member dw_cfi_next. diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 8b2412cca1a..bc7bf4a15e1 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -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)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 46ff86a1bfd..e4e33fb2ba8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-04-13 Jakub Jelinek + 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 index 00000000000..e6cb106d845 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr48591.c @@ -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; +} diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 52ea1433548..af2ad8e3cd8 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2011-04-13 Jakub Jelinek + + PR middle-end/48591 + * testsuite/libgomp.c/pr48591.c: New test. + 2011-03-21 Rainer Orth PR bootstrap/48135 diff --git a/libgomp/testsuite/libgomp.c/pr48591.c b/libgomp/testsuite/libgomp.c/pr48591.c new file mode 100644 index 00000000000..18dfd7f47be --- /dev/null +++ b/libgomp/testsuite/libgomp.c/pr48591.c @@ -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; +}