aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2020-11-25 20:36:55 +0100
committerThomas Schwinge <thomas@codesourcery.com>2020-11-26 10:02:38 +0100
commitc0c7270cc4efd896fe99f8ad5409dbef089a407f (patch)
tree54dc9d712d00e4e5219fe74191a811de27973805 /gcc/cp/parser.c
parentacdf30d66cac11757e95541aa35f5ce97de29f63 (diff)
downloadgcc-c0c7270cc4efd896fe99f8ad5409dbef089a407f.zip
gcc-c0c7270cc4efd896fe99f8ad5409dbef089a407f.tar.gz
gcc-c0c7270cc4efd896fe99f8ad5409dbef089a407f.tar.bz2
Don't create location wrapper nodes within OpenACC clauses
This fixes a GCC 11, 10, 9 regression introduced by commit dfd7fdca2ac17d8b823a16700525824ca312ade0 (Subversion r267272) "C++: more location wrapper nodes (PR c++/43064, PR c++/43486)". But: this isn't intending to blame David, because back then, the problem hasn't been visible in the testsuite (or else I'm sure would've been addressed right away) because of our all dear friend: missing testsuite coverage. Thus, for GCC 8, I'm likewise enhancing the testsuite, without the C++ front end code changes. I actually had presumed that there may be an issue for OpenACC: <http://mid.mail-archive.com/874lb9qr2u.fsf@euler.schwinge.homeip.net>, so here we are, two years (and many "wasted" hours...) later... gcc/cp/ * parser.c (cp_parser_omp_var_list_no_open): Assert that array section's 'low_bound', 'length' are not location wrapper nodes. (cp_parser_oacc_all_clauses, cp_parser_oacc_cache): Instantiate 'auto_suppress_location_wrappers'. gcc/testsuite/ * c-c++-common/goacc/cache-3-1.c: New. * c-c++-common/goacc/cache-3-2.c: Likewise. * c-c++-common/goacc/data-clause-1.c: Likewise. * c-c++-common/goacc/data-clause-2.c: Likewise. * c-c++-common/gomp/map-1.c: Adjust. * c-c++-common/gomp/map-2.c: Likewise. * g++.dg/goacc/cache-3-1.C: New. * g++.dg/goacc/cache-3-2.C: Likewise. * g++.dg/goacc/data-clause-1.C: Likewise. * g++.dg/goacc/data-clause-2.C: Likewise. * g++.dg/gomp/map-1.C: Adjust. * g++.dg/gomp/map-2.C: Likewise. Reported-by: Sandra Loosemore <sandra@codesourcery.com>
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index d11900a..63a2c96 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -34837,7 +34837,11 @@ cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind,
parser->colon_corrects_to_scope_p = false;
cp_lexer_consume_token (parser->lexer);
if (!cp_lexer_next_token_is (parser->lexer, CPP_COLON))
- low_bound = cp_parser_expression (parser);
+ {
+ low_bound = cp_parser_expression (parser);
+ /* Later handling is not prepared to see through these. */
+ gcc_checking_assert (!location_wrapper_p (low_bound));
+ }
if (!colon)
parser->colon_corrects_to_scope_p
= saved_colon_corrects_to_scope_p;
@@ -34857,7 +34861,11 @@ cp_parser_omp_var_list_no_open (cp_parser *parser, enum omp_clause_code kind,
cp_parser_commit_to_tentative_parse (parser);
if (!cp_lexer_next_token_is (parser->lexer,
CPP_CLOSE_SQUARE))
- length = cp_parser_expression (parser);
+ {
+ length = cp_parser_expression (parser);
+ /* Later handling is not prepared to see through these. */
+ gcc_checking_assert (!location_wrapper_p (length));
+ }
}
/* Look for the closing `]'. */
if (!cp_parser_require (parser, CPP_CLOSE_SQUARE,
@@ -37521,6 +37529,9 @@ cp_parser_oacc_all_clauses (cp_parser *parser, omp_clause_mask mask,
tree clauses = NULL;
bool first = true;
+ /* Don't create location wrapper nodes within OpenACC clauses. */
+ auto_suppress_location_wrappers sentinel;
+
while (cp_lexer_next_token_is_not (parser->lexer, CPP_PRAGMA_EOL))
{
location_t here;
@@ -41444,6 +41455,10 @@ check_clauses:
static tree
cp_parser_oacc_cache (cp_parser *parser, cp_token *pragma_tok)
{
+ /* Don't create location wrapper nodes within 'OMP_CLAUSE__CACHE_'
+ clauses. */
+ auto_suppress_location_wrappers sentinel;
+
tree stmt, clauses;
clauses = cp_parser_omp_var_list (parser, OMP_CLAUSE__CACHE_, NULL_TREE);