aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-05-04 08:29:16 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2006-05-04 08:29:16 +0200
commit76c5e6e079f5efe7ba978771e5234c303ca407c8 (patch)
treecd0e4b2189581cb9de48b625e69f5f862ffb856c /gcc
parent0ef1a53701b2673cab9c1a342694d66af5dc580a (diff)
downloadgcc-76c5e6e079f5efe7ba978771e5234c303ca407c8.zip
gcc-76c5e6e079f5efe7ba978771e5234c303ca407c8.tar.gz
gcc-76c5e6e079f5efe7ba978771e5234c303ca407c8.tar.bz2
re PR c++/27359 (ICE with missing initialization of iteration variable in parallel for loop)
PR c++/27359 * parser.c (cp_parser_omp_for_loop): Only call cp_parser_abort_tentative_parse if cp_parser_parse_definitely was not called. * g++.dg/gomp/pr27359.C: New test. From-SVN: r113513
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/parser.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/gomp/pr27359.C10
4 files changed, 25 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1b8438c..d4a01fc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2006-05-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/27359
+ * parser.c (cp_parser_omp_for_loop): Only call
+ cp_parser_abort_tentative_parse if cp_parser_parse_definitely was not
+ called.
+
2006-05-02 Mark Mitchell <mark@codesourcery.com>
PR c++/27102
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index ff8086f..bee7e9a 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -18506,14 +18506,13 @@ cp_parser_omp_for_loop (cp_parser *parser)
pop_scope (pushed_scope);
}
}
+ else
+ cp_parser_abort_tentative_parse (parser);
/* If parsing as an initialized declaration failed, try again as
a simple expression. */
if (decl == NULL)
- {
- cp_parser_abort_tentative_parse (parser);
- init = cp_parser_expression (parser, false);
- }
+ init = cp_parser_expression (parser, false);
}
cp_parser_require (parser, CPP_SEMICOLON, "`;'");
pre_body = pop_stmt_list (pre_body);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 399b36d..35e0698 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-04 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/27359
+ * g++.dg/gomp/pr27359.C: New test.
+
2006-05-02 Steven G. Kargl <kargls@comcast.net>
PR fortran/20248
diff --git a/gcc/testsuite/g++.dg/gomp/pr27359.C b/gcc/testsuite/g++.dg/gomp/pr27359.C
new file mode 100644
index 0000000..603898c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr27359.C
@@ -0,0 +1,10 @@
+// PR c++/27359
+// { dg-do compile }
+
+void
+foo ()
+{
+#pragma omp parallel for
+ for (int i; i < 1; ++i) // { dg-error "expected|was not declared" }
+ ;
+}