From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id D6EA23858C2F; Tue, 6 Sep 2022 07:28:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6EA23858C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662449296; bh=oj4J9eQVl/2eZy3EVuDV17lpvLnQoZPdu8P2rQf1ppI=; h=From:To:Subject:Date:From; b=Vh/oCwFiLAzwkQ04gOje6U7bavfXz5qm61kJZ5ojZt7mS7t4+QB8Izrii3/l0xmE3 QklpOa0W94GLRDBWgF5LnGan0agx1Q2q0Ymql3Mcu2mtuZ5+AskJtUZt2E5sPCS49M mSsj+aLDf4SDc+qayUMhWZYO35xc9pxuxOa8HWOs= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-2490] openmp: Be consistent on parsing offsets between normal sink vector and omp_cur_iteration - 1 X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: 1bf8b7adc2de6f2ddaffa3af131b6855ae3e3793 X-Git-Newrev: 0bd514107de7b0f643aa72554b3bdb5aeb5aa0f5 Message-Id: <20220906072816.D6EA23858C2F@sourceware.org> Date: Tue, 6 Sep 2022 07:28:16 +0000 (GMT) List-Id: https://gcc.gnu.org/g:0bd514107de7b0f643aa72554b3bdb5aeb5aa0f5 commit r13-2490-g0bd514107de7b0f643aa72554b3bdb5aeb5aa0f5 Author: Jakub Jelinek Date: Tue Sep 6 09:24:13 2022 +0200 openmp: Be consistent on parsing offsets between normal sink vector and omp_cur_iteration - 1 For normal sink vectors, we just check that the token is CPP_NUMBER and with INTEGER_CST value, while for omp_cur_iteration I was additionally requiring integer_type_node type (so only 1, 001, 0x0001 but not 1L or 1ULL etc.). I think we need to clarify what we actually should allow in the standard, until then it is better to be consistent. 2022-09-06 Jakub Jelinek gcc/c/ * c-parser.cc (c_parser_omp_clause_doacross_sink): Don't verify val in omp_cur_iteration - 1 has integer_type_node type. gcc/cp/ * parser.cc (cp_parser_omp_clause_doacross_sink): Don't verify val in omp_cur_iteration - 1 has integer_type_node type. gcc/testsuite/ * c-c++-common/gomp/doacross-6.c (corge): Don't expect an error here. Add a few further tests. Diff: --- gcc/c/c-parser.cc | 3 +-- gcc/cp/parser.cc | 3 +-- gcc/testsuite/c-c++-common/gomp/doacross-6.c | 24 ++++++++++++++++++++++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc index 65d73a615d4..72db5b527f8 100644 --- a/gcc/c/c-parser.cc +++ b/gcc/c/c-parser.cc @@ -15993,8 +15993,7 @@ c_parser_omp_clause_doacross_sink (c_parser *parser, location_t clause_loc, && c_parser_peek_nth_token (parser, 4)->type == CPP_CLOSE_PAREN) { tree val = c_parser_peek_nth_token (parser, 3)->value; - if (integer_onep (val) - && comptypes (TREE_TYPE (val), integer_type_node)) + if (integer_onep (val)) { c_parser_consume_token (parser); c_parser_consume_token (parser); diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index 076ad624380..289c2142e45 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -39355,8 +39355,7 @@ cp_parser_omp_clause_doacross_sink (cp_parser *parser, location_t clause_loc, && cp_lexer_nth_token_is (parser->lexer, 4, CPP_CLOSE_PAREN)) { tree val = cp_lexer_peek_nth_token (parser->lexer, 3)->u.value; - if (integer_onep (val) - && same_type_p (TREE_TYPE (val), integer_type_node)) + if (integer_onep (val)) { cp_lexer_consume_token (parser->lexer); cp_lexer_consume_token (parser->lexer); diff --git a/gcc/testsuite/c-c++-common/gomp/doacross-6.c b/gcc/testsuite/c-c++-common/gomp/doacross-6.c index d9e9f80655b..65ee8979a4f 100644 --- a/gcc/testsuite/c-c++-common/gomp/doacross-6.c +++ b/gcc/testsuite/c-c++-common/gomp/doacross-6.c @@ -81,6 +81,26 @@ corge (int n) #pragma omp for ordered for (i = 0; i < 8; i += n) { - #pragma omp ordered doacross(sink:omp_cur_iteration - 1LL) /* { dg-error "'omp_cur_iteration' undeclared \\\(first use in this function\\\)" "" { target c } } */ - } /* { dg-error "'omp_cur_iteration' has not been declared" "" { target c++ } .-1 } */ + #pragma omp ordered doacross(sink:omp_cur_iteration - 1) + } + #pragma omp for ordered + for (i = 0; i < 8; i += n) + { + #pragma omp ordered doacross(sink:omp_cur_iteration - 1LL) + } + #pragma omp for ordered + for (i = 0; i < 8; i += n) + { + #pragma omp ordered doacross(sink:omp_cur_iteration - 0x00001) + } + #pragma omp for ordered + for (i = 0; i < 8; i += n) + { + #pragma omp ordered doacross(sink:omp_cur_iteration - 001) + } + #pragma omp for ordered + for (i = 0; i < 8; i += n) + { + #pragma omp ordered doacross(sink:omp_cur_iteration - 1ULL) + } }