diff options
author | Jakub Jelinek <jakub@redhat.com> | 2015-09-10 09:28:27 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2015-09-10 09:28:27 +0200 |
commit | a8a098acfcfc0b59ddbbec9075ffb195c3e63b3e (patch) | |
tree | 26dc40f5eb481db44e34a8ea084d15971d27e065 /gcc/c | |
parent | 609df8a305e7d4a8325348078ba8d71638a3db25 (diff) | |
download | gcc-a8a098acfcfc0b59ddbbec9075ffb195c3e63b3e.zip gcc-a8a098acfcfc0b59ddbbec9075ffb195c3e63b3e.tar.gz gcc-a8a098acfcfc0b59ddbbec9075ffb195c3e63b3e.tar.bz2 |
re PR c/67502 (ICE with collapsed for simd loop inside of parallel)
PR c/67502
* c-parser.c (c_parser_omp_for_loop): Emit DECL_EXPR stmts
into OMP_FOR_PRE_BODY rather than before the loop.
* c-c++-common/gomp/pr67502.c: New test.
From-SVN: r227605
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c/c-parser.c | 20 |
2 files changed, 24 insertions, 2 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index d7eeb2da..cfc20aa 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,9 @@ +2015-09-10 Jakub Jelinek <jakub@redhat.com> + + PR c/67502 + * c-parser.c (c_parser_omp_for_loop): Emit DECL_EXPR stmts + into OMP_FOR_PRE_BODY rather than before the loop. + 2015-09-09 Jakub Jelinek <jakub@redhat.com> PR c/67501 diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 072f94b..4d9cbe0 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -12869,7 +12869,8 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code, tree clauses, tree *cclauses) { tree decl, cond, incr, save_break, save_cont, body, init, stmt, cl; - tree declv, condv, incrv, initv, ret = NULL; + tree declv, condv, incrv, initv, ret = NULL_TREE; + tree pre_body = NULL_TREE, this_pre_body; bool fail = false, open_brace_parsed = false; int i, collapse = 1, nbraces = 0; location_t for_loc; @@ -12913,8 +12914,23 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code, { if (i > 0) vec_safe_push (for_block, c_begin_compound_stmt (true)); + this_pre_body = push_stmt_list (); c_parser_declaration_or_fndef (parser, true, true, true, true, true, NULL, vNULL); + if (this_pre_body) + { + this_pre_body = pop_stmt_list (this_pre_body); + if (pre_body) + { + tree t = pre_body; + pre_body = push_stmt_list (); + add_stmt (t); + add_stmt (this_pre_body); + pre_body = pop_stmt_list (pre_body); + } + else + pre_body = this_pre_body; + } decl = check_for_loop_decls (for_loc, flag_isoc99); if (decl == NULL) goto error_init; @@ -13109,7 +13125,7 @@ c_parser_omp_for_loop (location_t loc, c_parser *parser, enum tree_code code, if (!fail) { stmt = c_finish_omp_for (loc, code, declv, initv, condv, - incrv, body, NULL); + incrv, body, pre_body); if (stmt) { if (cclauses != NULL |