diff mbox

PR c++/58567: Fix ICE on invalid code with -fopenmp in cp/pt.c

Message ID 52A114A1.8010504@net-b.de
State New
Headers show

Commit Message

Tobias Burnus Dec. 6, 2013, 12:04 a.m. UTC
A rather simple fix for an ICE on invalid bug (low-priority 4.8/4.9 
regression).

Bootstrapped and regtested without new failure on x86-64-gnu-linux.
OK for the trunk and 4.8?

Tobias

Comments

Tobias Burnus Dec. 11, 2013, 7:05 a.m. UTC | #1
Tobias Burnus wrote:
> A rather simple fix for an ICE on invalid bug (low-priority 4.8/4.9 
> regression).
>
> Bootstrapped and regtested without new failure on x86-64-gnu-linux.
> OK for the trunk and 4.8?
>
> Tobias
Tobias Burnus Dec. 15, 2013, 10:56 a.m. UTC | #2
*ping*
http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00584.html

On December 6, 2013, Tobias Burnus wrote:
> A rather simple fix for an ICE on invalid bug (low-priority 4.8/4.9 
> regression).
>
> Bootstrapped and regtested without new failure on x86-64-gnu-linux.
> OK for the trunk and 4.8?
>
> Tobias
Tobias Burnus Dec. 20, 2013, 7:08 a.m. UTC | #3
* ping *

Tobias Burnus wrote:
> *ping*
> http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00584.html
>
> On December 6, 2013, Tobias Burnus wrote:
>> A rather simple fix for an ICE on invalid bug (low-priority 4.8/4.9 
>> regression).
>>
>> Bootstrapped and regtested without new failure on x86-64-gnu-linux.
>> OK for the trunk and 4.8?
>>
>> Tobias
>
>
Tobias Burnus Jan. 2, 2014, 8:47 p.m. UTC | #4
*ping* - I think the patch is nearly obvious …

http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00584.html



On December 6, 2013, Tobias Burnus wrote:
> A rather simple fix for an ICE on invalid bug (low-priority 4.8/4.9 
> regression).
>
> Bootstrapped and regtested without new failure on x86-64-gnu-linux.
> OK for the trunk and 4.8?
>
> Tobias
Jason Merrill Jan. 3, 2014, 3:11 a.m. UTC | #5
On 01/02/2014 03:47 PM, Tobias Burnus wrote:
> http://gcc.gnu.org/ml/gcc-patches/2013-12/msg00584.html

OK, but please also check init for error_mark_node.

Jason
diff mbox

Patch

2013-06-12  Tobias Burnus  <burnus@net-b.de>

	PR c++/58567
	* pt.c (tsubst_omp_for_iterator): Early return for error_mark_node.

2013-06-12  Tobias Burnus  <burnus@net-b.de>

	PR c++/58567
	* g++.dg/gomp/pr58567.C: New.

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 25d940c..ddc7112 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)
+    return;
+
   if (init_decl)
     {
       gcc_assert (!processing_template_decl);
diff --git a/gcc/testsuite/g++.dg/gomp/pr58567.C b/gcc/testsuite/g++.dg/gomp/pr58567.C
new file mode 100644
index 0000000..35a5bb0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/gomp/pr58567.C
@@ -0,0 +1,15 @@ 
+/* { dg-do compile } */
+
+/* PR c++/58567 - was ICEing before */
+
+template<typename T> 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<int>();
+}