diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c8b81605f43..363f6cd6cd5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,11 @@ 2016-01-12 Jakub Jelinek + PR objc++/68511 + PR c++/69213 + * cp-gimplify.c (cp_gimplify_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. diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 14788026133..c0ee8e43466 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e6e01c75630..5eba1a19bf7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-01-12 Jakub Jelinek + + PR objc++/68511 + PR c++/69213 + * g++.dg/opt/pr69213.C: New test. + 2016-01-12 Christian Bruel 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 index 00000000000..8d94773852d --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr69213.C @@ -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; +}