public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Tobias Burnus <burnus@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc/devel/omp/gcc-12] openmp: Be consistent on parsing offsets between normal sink vector and omp_cur_iteration - 1
Date: Wed,  7 Sep 2022 11:01:56 +0000 (GMT)	[thread overview]
Message-ID: <20220907110156.269463850841@sourceware.org> (raw)

https://gcc.gnu.org/g:943cc3e7ed020a2a841419bba1516cf47c7e2e81

commit 943cc3e7ed020a2a841419bba1516cf47c7e2e81
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Sep 6 10:19:45 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  <jakub@redhat.com>
    
    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.
    
    (cherry picked from commit 0bd514107de7b0f643aa72554b3bdb5aeb5aa0f5)

Diff:
---
 gcc/c/ChangeLog.omp                          |  8 ++++++++
 gcc/c/c-parser.cc                            |  3 +--
 gcc/cp/ChangeLog.omp                         |  8 ++++++++
 gcc/cp/parser.cc                             |  3 +--
 gcc/testsuite/ChangeLog.omp                  |  8 ++++++++
 gcc/testsuite/c-c++-common/gomp/doacross-6.c | 24 ++++++++++++++++++++++--
 6 files changed, 48 insertions(+), 6 deletions(-)

diff --git a/gcc/c/ChangeLog.omp b/gcc/c/ChangeLog.omp
index 32940146b60..9d15f19b98d 100644
--- a/gcc/c/ChangeLog.omp
+++ b/gcc/c/ChangeLog.omp
@@ -1,3 +1,11 @@
+2022-09-06  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backport from mainline:
+	2022-09-06  Jakub Jelinek  <jakub@redhat.com>
+
+	* c-parser.cc (c_parser_omp_clause_doacross_sink): Don't verify val
+	in omp_cur_iteration - 1 has integer_type_node type.
+
 2022-09-05  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline:
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 70b72ad6fd7..36450a43beb 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -16170,8 +16170,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/ChangeLog.omp b/gcc/cp/ChangeLog.omp
index 07e7be2f819..97a956f0245 100644
--- a/gcc/cp/ChangeLog.omp
+++ b/gcc/cp/ChangeLog.omp
@@ -1,3 +1,11 @@
+2022-09-06  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backport from mainline:
+	2022-09-06  Jakub Jelinek  <jakub@redhat.com>
+
+	* parser.cc (cp_parser_omp_clause_doacross_sink): Don't verify val
+	in omp_cur_iteration - 1 has integer_type_node type.
+
 2022-09-05  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline:
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 4c82ad150a2..93283f7a509 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -39354,8 +39354,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/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index 58d89825dd0..0d64c7a6d40 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -1,3 +1,11 @@
+2022-09-06  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backport from mainline:
+	2022-09-06  Jakub Jelinek  <jakub@redhat.com>
+
+	* c-c++-common/gomp/doacross-6.c (corge): Don't expect an error here.
+	Add a few further tests.
+
 2022-07-06  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline:
diff --git a/gcc/testsuite/c-c++-common/gomp/doacross-6.c b/gcc/testsuite/c-c++-common/gomp/doacross-6.c
index d126ad1bb2d..b948d07cd22 100644
--- a/gcc/testsuite/c-c++-common/gomp/doacross-6.c
+++ b/gcc/testsuite/c-c++-common/gomp/doacross-6.c
@@ -69,6 +69,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)
+    }
 }

                 reply	other threads:[~2022-09-07 11:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220907110156.269463850841@sourceware.org \
    --to=burnus@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).