]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR objc++/68511
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Jan 2016 15:21:27 +0000 (15:21 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 12 Jan 2016 15:21:27 +0000 (15:21 +0000)
PR c++/69213
* cp-gimplify.c (cp_gimplify_expr) <case INIT_EXPR>: Don't return
GS_ERROR whenever seen_error (), only if *expr_p contains
cilk spawn stmt, but cilk_detect_spawn_and_unwrap failed.

* g++.dg/opt/pr69213.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232278 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr69213.C [new file with mode: 0644]

index c8b81605f43ca93e0fa0273612fd7e0f6599b2ca..363f6cd6cd56db9cdbcec24e7b198ae2da04d349 100644 (file)
@@ -1,5 +1,11 @@
 2016-01-12  Jakub Jelinek  <jakub@redhat.com>
 
+       PR objc++/68511
+       PR c++/69213
+       * cp-gimplify.c (cp_gimplify_expr) <case INIT_EXPR>: Don't return
+       GS_ERROR whenever seen_error (), only if *expr_p contains
+       cilk spawn stmt, but cilk_detect_spawn_and_unwrap failed.
+
        PR c++/66808
        PR c++/69000
        * pt.c (tsubst_decl): If not local_p, clear DECL_TEMPLATE_INFO.
index 14788026133e041c67db8f648bf8a92a2510cbc7..c0ee8e434667f1f7822c31b8bc0911dbd41154f5 100644 (file)
@@ -617,14 +617,17 @@ cp_gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
         LHS of an assignment might also be involved in the RHS, as in bug
         25979.  */
     case INIT_EXPR:
-      if (fn_contains_cilk_spawn_p (cfun)
-         && cilk_detect_spawn_and_unwrap (expr_p))
+      if (fn_contains_cilk_spawn_p (cfun))
        {
-         cilk_cp_gimplify_call_params_in_spawned_fn (expr_p, pre_p, post_p);
-         return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
+         if (cilk_detect_spawn_and_unwrap (expr_p))
+           {
+             cilk_cp_gimplify_call_params_in_spawned_fn (expr_p,
+                                                         pre_p, post_p);
+             return (enum gimplify_status) gimplify_cilk_spawn (expr_p);
+           }
+         if (seen_error () && contains_cilk_spawn_stmt (*expr_p))
+           return GS_ERROR;
        }
-      if (seen_error ())
-       return GS_ERROR;
 
       cp_gimplify_init_expr (expr_p);
       if (TREE_CODE (*expr_p) != INIT_EXPR)
index e6e01c756302bd04b506ba93c84c2d3bf25dda9b..5eba1a19bf70702da4c9c3c30818e7e34ff12483 100644 (file)
@@ -1,3 +1,9 @@
+2016-01-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR objc++/68511
+       PR c++/69213
+       * g++.dg/opt/pr69213.C: New test.
+
 2016-01-12  Christian Bruel  <christian.bruel@st.com>
 
        PR target/69180
diff --git a/gcc/testsuite/g++.dg/opt/pr69213.C b/gcc/testsuite/g++.dg/opt/pr69213.C
new file mode 100644 (file)
index 0000000..8d94773
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/69213
+// { dg-do compile }
+// { dg-options "-O3" }
+
+int a, b;
+
+void
+foo (void)
+{
+  __asm__ ("# %0" : : : "memory");     // { dg-error "operand number out of range" }
+}
+
+int
+main ()
+{
+  for (; a < 0; b++)
+    a = b;
+}