From 4ca56230c68d953102c411f6accfb42a7a61094e Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 29 Jan 2014 13:36:22 +0000 Subject: re PR c++/58702 (ICE with undeclared variable in OpenMP reduction clause) /cp 2014-01-29 Paolo Carlini PR c++/58702 * semantics.c (finish_omp_reduction_clause): Check type for error_mark_node. /testsuite 2014-01-29 Paolo Carlini PR c++/58702 * g++.dg/gomp/pr58702.C: New. From-SVN: r207235 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 4 +++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/gomp/pr58702.C | 10 ++++++++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/gomp/pr58702.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 31217e7..3ed0ef8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2014-01-29 Paolo Carlini + + PR c++/58702 + * semantics.c (finish_omp_reduction_clause): Check type for + error_mark_node. + 2014-01-28 Jason Merrill PR c++/59791 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index fd6466d..9fb4fc0 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5021,7 +5021,9 @@ finish_omp_reduction_clause (tree c, bool *need_default_ctor, bool *need_dtor) tree type = TREE_TYPE (t); if (TREE_CODE (type) == REFERENCE_TYPE) type = TREE_TYPE (type); - if (ARITHMETIC_TYPE_P (type)) + if (type == error_mark_node) + return true; + else if (ARITHMETIC_TYPE_P (type)) switch (OMP_CLAUSE_REDUCTION_CODE (c)) { case PLUS_EXPR: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 27777da..1e8f971 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-01-29 Paolo Carlini + + PR c++/58702 + * g++.dg/gomp/pr58702.C: New. + 2014-01-29 Dodji Seketeli * c-c++-common/cpp/warning-zero-location-2.c: Fix error message diff --git a/gcc/testsuite/g++.dg/gomp/pr58702.C b/gcc/testsuite/g++.dg/gomp/pr58702.C new file mode 100644 index 0000000..5bab861 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr58702.C @@ -0,0 +1,10 @@ +// PR c++/58702 +// { dg-do compile } +// { dg-options "-fopenmp" } + +void foo() +{ + x; // { dg-error "was not declared" } +#pragma omp parallel for reduction(+:x) + for (int i = 0; i < 10; ++i) ; +} -- cgit v1.1