]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/64824 (ICE in gimple verification)
authorJakub Jelinek <jakub@redhat.com>
Wed, 11 Feb 2015 13:40:31 +0000 (14:40 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 11 Feb 2015 13:40:31 +0000 (14:40 +0100)
PR c/64824
* c-parser.c (c_parser_binary_expression): Fix OpenMP stack[sp].prec
check in the POP macro.

* testsuite/libgomp.c/atomic-18.c: New test.
* testsuite/libgomp.c++/atomic-16.C: New test.

From-SVN: r220617

gcc/c/ChangeLog
gcc/c/c-parser.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.c++/atomic-16.C [new file with mode: 0644]
libgomp/testsuite/libgomp.c/atomic-18.c [new file with mode: 0644]

index fa5774cbea0e7b7b36c1d78a62b5bfe639fb2c38..ab917cb9357f5f55c9f3a8f9ab52a11da10768e3 100644 (file)
@@ -1,3 +1,9 @@
+2015-02-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/64824
+       * c-parser.c (c_parser_binary_expression): Fix OpenMP stack[sp].prec
+       check in the POP macro.
+
 2015-02-09  Marek Polacek  <polacek@redhat.com>
 
        PR c/64856
index 982ba6a894cf24d60ff9fa7ebc1571a7d4a7cab5..ceb9e1a78e7c567d20da2220ff551702118ef1de 100644 (file)
@@ -6233,8 +6233,8 @@ c_parser_binary_expression (c_parser *parser, struct c_expr *after,
     if (__builtin_expect (omp_atomic_lhs != NULL_TREE, 0) && sp == 1         \
        && c_parser_peek_token (parser)->type == CPP_SEMICOLON                \
        && ((1 << stack[sp].prec)                                             \
-           & (1 << (PREC_BITOR | PREC_BITXOR | PREC_BITAND | PREC_SHIFT      \
-                    | PREC_ADD | PREC_MULT)))                                \
+           & ((1 << PREC_BITOR) | (1 << PREC_BITXOR) | (1 << PREC_BITAND)    \
+              | (1 << PREC_SHIFT) | (1 << PREC_ADD) | (1 << PREC_MULT)))     \
        && stack[sp].op != TRUNC_MOD_EXPR                                     \
        && stack[0].expr.value != error_mark_node                             \
        && stack[1].expr.value != error_mark_node                             \
index 21b42d154e890893ac1ae4ebc24091d4f233fbd9..6c24531744cea380cbbf2cd85fb9a5d8c5b02fb3 100644 (file)
@@ -1,3 +1,9 @@
+2015-02-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/64824
+       * testsuite/libgomp.c/atomic-18.c: New test.
+       * testsuite/libgomp.c++/atomic-16.C: New test.
+
 2015-02-04  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/64824
diff --git a/libgomp/testsuite/libgomp.c++/atomic-16.C b/libgomp/testsuite/libgomp.c++/atomic-16.C
new file mode 100644 (file)
index 0000000..afccd52
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c/64824
+// { dg-do run }
+// { dg-options "-O2 -fopenmp" }
+
+#include "../libgomp.c/atomic-18.c"
diff --git a/libgomp/testsuite/libgomp.c/atomic-18.c b/libgomp/testsuite/libgomp.c/atomic-18.c
new file mode 100644 (file)
index 0000000..bd048c1
--- /dev/null
@@ -0,0 +1,61 @@
+/* PR c/64824 */
+/* { dg-do run } */
+/* { dg-options "-O2 -fopenmp" } */
+
+void
+f1 (void)
+{
+  short a;
+  short b = 1;
+  int c = 3;
+#pragma omp atomic capture
+  a = b = c << b;
+  if (b != 6 || a != 6)
+    __builtin_abort ();
+}
+
+void
+f2 (void)
+{
+  short a;
+  short b = 1;
+  int c = 3;
+#pragma omp atomic capture
+  a = b = c + b;
+  if (b != 4 || a != 4)
+    __builtin_abort ();
+}
+
+void
+f3 (void)
+{
+  short a;
+  short b = 1;
+  long long int c = 3;
+#pragma omp atomic capture
+  a = b = c + b;
+  if (b != 4 || a != 4)
+    __builtin_abort ();
+}
+
+void
+f4 (void)
+{
+  char a;
+  char b = 1;
+  long long int c = 3LL;
+#pragma omp atomic capture
+  a = b = c << b;
+  if (b != 6 || a != 6)
+    __builtin_abort ();
+}
+
+int
+main ()
+{
+  f1 ();
+  f2 ();
+  f3 ();
+  f4 ();
+  return 0;
+}