From: Tobias Burnus Date: Fri, 3 Jan 2014 20:24:50 +0000 (+0100) Subject: re PR c++/58567 (ICE with invalid loop variable in template using openmp) X-Git-Tag: releases/gcc-4.9.0~1842 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=54a990d324f731560ccf4eaec64c6ec9da33eb7d;p=thirdparty%2Fgcc.git re PR c++/58567 (ICE with invalid loop variable in template using openmp) 2014-01-03 Tobias Burnus PR c++/58567 * pt.c (tsubst_omp_for_iterator): Early return for * error_mark_node. 2014-01-03 Tobias Burnus PR c++/58567 * g++.dg/gomp/pr58567.C: New. From-SVN: r206322 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e89bc50baa81..70211081dbf1 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-01-03 Tobias Burnus + + PR c++/58567 + * pt.c (tsubst_omp_for_iterator): Early return for error_mark_node. + 2014-01-03 Paolo Carlini Core DR 1442 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 3b8f83a596c0..98d7365a7cca 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13035,6 +13035,10 @@ tsubst_omp_for_iterator (tree t, int i, tree declv, tree initv, init_decl = (init && TREE_CODE (init) == DECL_EXPR); init = RECUR (init); decl = RECUR (decl); + + if (decl == error_mark_node || init == error_mark_node) + return; + if (init_decl) { gcc_assert (!processing_template_decl); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b7639618d192..ebf40341ef5f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-01-03 Tobias Burnus + + PR c++/58567 + * g++.dg/gomp/pr58567.C: New. + 2014-01-03 Bingfeng Mei PR tree-optimization/59651 diff --git a/gcc/testsuite/g++.dg/gomp/pr58567.C b/gcc/testsuite/g++.dg/gomp/pr58567.C new file mode 100644 index 000000000000..35a5bb027ffe --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr58567.C @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +/* PR c++/58567 - was ICEing before */ + +template void foo() +{ + #pragma omp parallel for + for (typename T::X i = 0; i < 100; ++i) /* { dg-error "'int' is not a class, struct, or union type|expected iteration declaration or initialization" } */ + ; +} + +void bar() +{ + foo(); +}