aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-06-25 09:00:34 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-06-25 09:00:34 +0200
commit361af3e4194ce1d9620e2c3506115bba9ef18efa (patch)
treecac48b84b635c08d6384529a3016fa9e781ee107 /gcc
parent32bab8b6ad0a9079ae306eb7c6bbfad0d749623f (diff)
downloadgcc-361af3e4194ce1d9620e2c3506115bba9ef18efa.zip
gcc-361af3e4194ce1d9620e2c3506115bba9ef18efa.tar.gz
gcc-361af3e4194ce1d9620e2c3506115bba9ef18efa.tar.bz2
re PR sanitizer/90954 (ICE: combining undefined behavior sanitizer with openmp)
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog6
-rw-r--r--gcc/c-family/c-omp.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/c-c++-common/gomp/pr90954.c27
4 files changed, 39 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index d093e20..d400736 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+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
diff --git a/gcc/c-family/c-omp.c b/gcc/c-family/c-omp.c
index 96b2e45..97206a1 100644
--- a/gcc/c-family/c-omp.c
+++ b/gcc/c-family/c-omp.c
@@ -305,7 +305,7 @@ c_finish_omp_atomic (location_t loc, enum tree_code code,
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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b287208..ecfca8d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+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.
diff --git a/gcc/testsuite/c-c++-common/gomp/pr90954.c b/gcc/testsuite/c-c++-common/gomp/pr90954.c
new file mode 100644
index 0000000..cc3a6e9
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/pr90954.c
@@ -0,0 +1,27 @@
+/* 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);
+}