PR sanitizer/90954
* c-omp.c (c_finish_omp_atomic): Allow tree_invariant_p in addition
to SAVE_EXPR in first operand of a COMPOUND_EXPR.
* c-c++-common/gomp/pr90954.c: New test.
From-SVN: r272635
+2019-06-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/90954
+ * c-omp.c (c_finish_omp_atomic): Allow tree_invariant_p in addition
+ to SAVE_EXPR in first operand of a COMPOUND_EXPR.
+
2019-06-24 Jan Hubicka <jh@suse.cz>
* c-common.c (braced_lists_to_strings): Check that
if (TREE_CODE (x) == COMPOUND_EXPR)
{
pre = TREE_OPERAND (x, 0);
- gcc_assert (TREE_CODE (pre) == SAVE_EXPR);
+ gcc_assert (TREE_CODE (pre) == SAVE_EXPR || tree_invariant_p (pre));
x = TREE_OPERAND (x, 1);
}
gcc_assert (TREE_CODE (x) == MODIFY_EXPR);
+2019-06-25 Jakub Jelinek <jakub@redhat.com>
+
+ PR sanitizer/90954
+ * c-c++-common/gomp/pr90954.c: New test.
+
2019-06-24 Iain Sandoe <iain@sandoe.co.uk>
* gcc.target/powerpc/safe-indirect-jump-1.c: Skip for Darwin.
--- /dev/null
+/* PR sanitizer/90954 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp -fsanitize=undefined" } */
+
+float v;
+int i;
+
+void
+foo (float x, float y)
+{
+ #pragma omp atomic
+ v += x / y;
+}
+
+void
+bar (int x, int y)
+{
+ #pragma omp atomic
+ i += x / y;
+}
+
+void
+baz (int x, int y)
+{
+ #pragma omp atomic
+ i *= (x << y);
+}