PR middle-end/35611
* gimplify.c (gimplify_expr): Gimplify second operand of
OMP_ATOMIC_LOAD.
* testsuite/libgomp.c/atomic-4.c: New test.
From-SVN: r133309
+2008-03-18 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/35611
+ * gimplify.c (gimplify_expr): Gimplify second operand of
+ OMP_ATOMIC_LOAD.
+
2008-03-17 Richard Guenther <rguenther@suse.de>
PR tree-optimization/19637
case OMP_RETURN:
case OMP_CONTINUE:
- case OMP_ATOMIC_LOAD:
- case OMP_ATOMIC_STORE:
-
+ case OMP_ATOMIC_STORE:
ret = GS_ALL_DONE;
break;
+ case OMP_ATOMIC_LOAD:
+ if (gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, NULL,
+ is_gimple_val, fb_rvalue) != GS_ALL_DONE)
+ ret = GS_ERROR;
+ else
+ ret = GS_ALL_DONE;
+ break;
+
case POINTER_PLUS_EXPR:
/* Convert ((type *)A)+offset into &A->field_of_type_and_offset.
The second is gimple immediate saving a need for extra statement.
2008-03-18 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/35611
+ * testsuite/libgomp.c/atomic-4.c: New test.
+
PR libgomp/35625
* iter.c (gomp_iter_guided_next_locked): If q > n, set end to ws->end.
(gomp_iter_guided_next): Likewise.
--- /dev/null
+/* PR middle-end/35611 */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+int
+main (void)
+{
+ long double d = .0L;
+ int i;
+ #pragma omp parallel for shared (d)
+ for (i = 0; i < 1000; i++)
+ #pragma omp atomic
+ d += 1.0L;
+ if (d != 1000.0L)
+ abort ();
+ return 0;
+}