re PR c/25996 ([gomp] ICE on undefined iteration variable)

PR c/25996
	* c-parser.c (c_parser_omp_for_loop): Don't call c_finish_omp_for if
	either decl or init is error_mark_node.

	* gcc.dg/gomp/pr25996.c: New test.
	* g++.dg/gomp/pr25996.C: New test.

From-SVN: r113269
This commit is contained in:
Jakub Jelinek 2006-04-26 10:23:12 +02:00 committed by Jakub Jelinek
parent 21a66e91d0
commit 1562e1fee7
5 changed files with 75 additions and 1 deletions

View File

@ -1,5 +1,9 @@
2006-04-26 Jakub Jelinek <jakub@redhat.com>
PR c/25996
* c-parser.c (c_parser_omp_for_loop): Don't call c_finish_omp_for if
either decl or init is error_mark_node.
PR middle-end/25989
* tree-flow.h (struct omp_region): Add sched_kind.
* omp-low.c (expand_parallel_call): Use region->inner->sched_kind

View File

@ -7379,7 +7379,7 @@ c_parser_omp_for_loop (c_parser *parser)
/* Only bother calling c_finish_omp_for if we havn't already generated
an error from the initialization parsing. */
if (decl != NULL)
if (decl != NULL && decl != error_mark_node && init != error_mark_node)
return c_finish_omp_for (loc, decl, init, cond, incr, body, NULL);
return NULL;

View File

@ -1,3 +1,9 @@
2006-04-26 Jakub Jelinek <jakub@redhat.com>
PR c/25996
* gcc.dg/gomp/pr25996.c: New test.
* g++.dg/gomp/pr25996.C: New test.
2006-04-25 Richard Sandiford <richard@codesourcery.com>
PR rtl-optimization/26725

View File

@ -0,0 +1,32 @@
// PR c/25996
void
test1 (void)
{
#pragma omp for
for (i = 0; i < 1; ++i); // { dg-error "not declared|expected iteration decl" }
}
void
test2 (void)
{
int i;
#pragma omp for
for (i = j; i < 1; ++i); // { dg-error "not declared|expected iteration decl" }
}
void
test3 (void)
{
int i;
#pragma omp for
for (i = 0; i < j; ++i); // { dg-error "not declared|invalid controlling predicate" }
}
void
test4 (void)
{
int i;
#pragma omp for
for (i = 0; i < 10; i += j); // { dg-error "not declared|invalid increment expression" }
}

View File

@ -0,0 +1,32 @@
/* PR c/25996 */
void
test1 (void)
{
#pragma omp for
for (i = 0; i < 1; ++i); /* { dg-error "undeclared|for each function" } */
}
void
test2 (void)
{
int i;
#pragma omp for
for (i = j; i < 1; ++i); /* { dg-error "undeclared" } */
}
void
test3 (void)
{
int i;
#pragma omp for
for (i = 0; i < j; ++i); /* { dg-error "undeclared|invalid controlling predicate" } */
}
void
test4 (void)
{
int i;
#pragma omp for
for (i = 0; i < 10; i += j); /* { dg-error "undeclared|invalid increment expression" } */
}