diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-01-22 18:25:37 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-01-22 18:25:37 +0100 |
commit | 61c3a446a26621584ec95c6317df22826e301734 (patch) | |
tree | 1c406740b0055c955a3dfd59b712cbd0ff764cc9 /gcc/c-parser.c | |
parent | 270e749db4e806317425bf51a774c87eae069057 (diff) | |
download | gcc-61c3a446a26621584ec95c6317df22826e301734.zip gcc-61c3a446a26621584ec95c6317df22826e301734.tar.gz gcc-61c3a446a26621584ec95c6317df22826e301734.tar.bz2 |
re PR c++/34607 (ICE with invalid for loop after #pragma omp for)
PR c++/34607
* c-parser.c (c_parser_omp_for_loop): Don't call c_finish_omp_for
if DECL_INITIAL (decl) is error_mark_node.
* semantics.c (finish_omp_for): Don't call c_finish_omp_for
if decl or init is error_mark_node.
* gcc.dg/gomp/pr34607.c: New test.
* g++.dg/gomp/pr34607.C: New test.
From-SVN: r131730
Diffstat (limited to 'gcc/c-parser.c')
-rw-r--r-- | gcc/c-parser.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/c-parser.c b/gcc/c-parser.c index 107b114..72f8a21 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -7547,6 +7547,8 @@ c_parser_omp_for_loop (c_parser *parser) decl = check_for_loop_decls (); if (decl == NULL) goto error_init; + if (DECL_INITIAL (decl) == error_mark_node) + decl = error_mark_node; init = decl; } else if (c_parser_next_token_is (parser, CPP_NAME) @@ -7597,7 +7599,7 @@ c_parser_omp_for_loop (c_parser *parser) c_break_label = save_break; c_cont_label = save_cont; - /* Only bother calling c_finish_omp_for if we havn't already generated + /* Only bother calling c_finish_omp_for if we haven't already generated an error from the initialization parsing. */ if (decl != NULL && decl != error_mark_node && init != error_mark_node) return c_finish_omp_for (loc, decl, init, cond, incr, body, NULL); |