public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r9-9396] openmp: Avoid ICE on depend clause on depobj OpenMP construct [PR98072]
Date: Tue, 20 Apr 2021 23:30:21 +0000 (GMT)	[thread overview]
Message-ID: <20210420233021.A5F413AA8C77@sourceware.org> (raw)

https://gcc.gnu.org/g:705afe9b40aabbe395baa2979cdac0a9fef194ef

commit r9-9396-g705afe9b40aabbe395baa2979cdac0a9fef194ef
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Dec 1 21:41:44 2020 +0100

    openmp: Avoid ICE on depend clause on depobj OpenMP construct [PR98072]
    
    Since r11-5430 we ICE on the following testcase.  When parsing the depobj
    directive we don't really use cp_parser_omp_all_clauses routine which ATM
    disables generation of location wrappers and the newly added assertion
    that there are no location wrappers thus triggers.
    
    Fixed by adding the location wrappers suppression sentinel.
    
    Longer term, we should handle location wrappers inside of OpenMP clauses.
    
    2020-12-01  Jakub Jelinek  <jakub@redhat.com>
    
            PR c++/98072
            * parser.c (cp_parser_omp_depobj): Suppress location wrappers when
            parsing depend clause.
    
            * c-c++-common/gomp/depobj-2.c: New test.
    
    (cherry picked from commit d62daad11b21a2ee9c39a43c5e94e7b966793dbd)

Diff:
---
 gcc/cp/parser.c                            |  2 ++
 gcc/testsuite/c-c++-common/gomp/depobj-2.c | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 64dde058dd3..7fda6bb99ba 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -36291,6 +36291,8 @@ cp_parser_omp_depobj (cp_parser *parser, cp_token *pragma_tok)
       cp_lexer_consume_token (parser->lexer);
       if (!strcmp ("depend", p))
 	{
+	  /* Don't create location wrapper nodes within the depend clause.  */
+	  auto_suppress_location_wrappers sentinel;
 	  clause = cp_parser_omp_clause_depend (parser, NULL_TREE, c_loc);
 	  if (clause)
 	    clause = finish_omp_clauses (clause, C_ORT_OMP);
diff --git a/gcc/testsuite/c-c++-common/gomp/depobj-2.c b/gcc/testsuite/c-c++-common/gomp/depobj-2.c
new file mode 100644
index 00000000000..d06910c420a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/gomp/depobj-2.c
@@ -0,0 +1,11 @@
+/* PR c++/98072 */
+
+typedef struct __attribute__((__aligned__ (sizeof (void *)))) omp_depend_t {
+  char __omp_depend_t__[2 * sizeof (void *)];
+} omp_depend_t;
+
+void
+foo (int *x, omp_depend_t *y, int z)
+{
+  #pragma omp depobj (*y) depend (in: x[z])
+}


                 reply	other threads:[~2021-04-20 23:30 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=20210420233021.A5F413AA8C77@sourceware.org \
    --to=jakub@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).