From 863bbe2b5fa075ef661be94845035644905d8237 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 19 Nov 2019 09:52:31 +0100 Subject: [PATCH] re PR c++/92504 (ICE on gcc-9 -fopenmp: internal compiler error: tree check: expected tree that contains 'decl common' structure, have 'baselink' in get_inner_reference, at expr.c:7238) PR c++/92504 * semantics.c (handle_omp_for_class_iterator): Don't call cp_fully_fold on cond. * g++.dg/gomp/pr92504.C: New test. From-SVN: r278433 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/semantics.c | 1 - gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/gomp/pr92504.C | 29 +++++++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/gomp/pr92504.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9bf64dfa626..30ebf18a244 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2019-11-19 Jakub Jelinek + + PR c++/92504 + * semantics.c (handle_omp_for_class_iterator): Don't call + cp_fully_fold on cond. + 2019-11-18 Paolo Carlini * typeck.c (cp_build_addr_expr_1): Use cp_expr_loc_or_input_loc diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 0ce73af5bc6..2adc9ef792b 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -8434,7 +8434,6 @@ handle_omp_for_class_iterator (int i, location_t locus, enum tree_code code, if (init && EXPR_HAS_LOCATION (init)) elocus = EXPR_LOCATION (init); - cond = cp_fully_fold (cond); switch (TREE_CODE (cond)) { case GT_EXPR: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 193a8d84890..b569888344b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-11-19 Jakub Jelinek + PR c++/92504 + * g++.dg/gomp/pr92504.C: New test. + PR tree-optimization/92557 * gcc.dg/gomp/pr92557.c: New test. diff --git a/gcc/testsuite/g++.dg/gomp/pr92504.C b/gcc/testsuite/g++.dg/gomp/pr92504.C new file mode 100644 index 00000000000..8df67621532 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr92504.C @@ -0,0 +1,29 @@ +// PR c++/92504 +// { dg-do compile { target c++11 } } +// { dg-additional-options "-O2" } + +namespace std { + typedef __SIZE_TYPE__ size_t; + typedef __PTRDIFF_TYPE__ ptrdiff_t; +} + +struct A { + A (); + A (const A &); + A & operator++ (); + bool operator != (const A &) const; + std::ptrdiff_t operator - (const A &); + A & operator += (std::size_t); + int a; + A & begin (); + A & end (); // { dg-message "declared here" } +}; + +void +bar () +{ + A a; + #pragma omp for + for (auto b = a; b != a.end; ++b) // { dg-error "invalid use of non-static member function" } + ; +} -- 2.30.2