From a7ea9e2968dd6dc207e554ce89b16c291f4120a1 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 19 Jul 2008 21:22:51 +0200 Subject: [PATCH] re PR middle-end/36877 (-O0 -fopenmp -march=i386 atomics) PR middle-end/36877 * omp-low.c (expand_omp_atomic_fetch_op): Make sure the return value of the builtin is ignored. * gcc.dg/gomp/atomic-11.c: New test. From-SVN: r137989 --- gcc/ChangeLog | 6 ++++++ gcc/omp-low.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/gomp/atomic-11.c | 17 +++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/gomp/atomic-11.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 392ba5876c9..701b25f787e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2008-07-19 Jakub Jelinek + + PR middle-end/36877 + * omp-low.c (expand_omp_atomic_fetch_op): Make sure the + return value of the builtin is ignored. + 2008-07-19 Olivier Hainque * doc/tm.texi (MALLOC_ABI_ALIGNMENT): New macro. Alignment, in diff --git a/gcc/omp-low.c b/gcc/omp-low.c index 2f9aedeac39..8ee717a36a1 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -4742,6 +4742,7 @@ expand_omp_atomic_fetch_op (basic_block load_bb, bsi = bsi_last (load_bb); gcc_assert (TREE_CODE (bsi_stmt (bsi)) == OMP_ATOMIC_LOAD); call = build_call_expr (decl, 2, addr, fold_convert (itype, rhs)); + call = fold_convert (void_type_node, call); force_gimple_operand_bsi (&bsi, call, true, NULL_TREE, true, BSI_SAME_STMT); bsi_remove (&bsi, true); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6ac4232c026..1114de11d77 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-07-19 Jakub Jelinek + + PR middle-end/36877 + * gcc.dg/gomp/atomic-11.c: New test. + 2008-07-19 Tobias Burnus PR fortran/36795 diff --git a/gcc/testsuite/gcc.dg/gomp/atomic-11.c b/gcc/testsuite/gcc.dg/gomp/atomic-11.c new file mode 100644 index 00000000000..397972b3cf2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/atomic-11.c @@ -0,0 +1,17 @@ +/* PR middle-end/36877 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ +/* { dg-options "-fopenmp -march=i386" { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */ + +int i; +float f; + +void foo (void) +{ +#pragma omp atomic + i++; +#pragma omp atomic + f += 1.0; +} + +/* { dg-final { scan-assembler-not "__sync_(fetch|add|bool|val)" { target i?86-*-* x86_64-*-* powerpc*-*-* ia64-*-* s390*-*-* sparc*-*-* } } } */ -- 2.30.2