public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Chung-Lin Tang <cltang@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/omp/gcc-11] openmp: Fix ICE in [PR103705] Date: Thu, 27 Jan 2022 10:46:19 +0000 (GMT) [thread overview] Message-ID: <20220127104619.AC01F3945C3D@sourceware.org> (raw) https://gcc.gnu.org/g:96a3b111881df93861a69b98d6fd9ac1b0f94999 commit 96a3b111881df93861a69b98d6fd9ac1b0f94999 Author: Chung-Lin Tang <cltang@codesourcery.com> Date: Fri Jan 14 21:58:34 2022 +0800 openmp: Fix ICE in [PR103705] Fix ICE for cases like: #pragma omp target update from(s[0].a[0:1]) where multiple ARRAY_REF nodes exist and require more than one peeling during [c_]finish_omp_clauses. PR c++/103705 gcc/c/ChangeLog: * c-typeck.c (c_finish_omp_clauses): Also continue peeling off of outer node for ARRAY_REFs. gcc/cp/ChangeLog: * semantics.c (finish_omp_clauses): Also continue peeling off of outer node for ARRAY_REFs. gcc/testsuite/ChangeLog: * c-c++-common/gomp/pr103705.c: New test. (cherry picked from commit cd7484d05cd4b7a9d741fe8bf6c4525406ed7620) Diff: --- gcc/c/c-typeck.c | 3 ++- gcc/cp/semantics.c | 3 ++- gcc/testsuite/c-c++-common/gomp/pr103705.c | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index 7d68a28014e..29f53a926e3 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -14863,7 +14863,8 @@ c_finish_omp_clauses (tree clauses, enum c_omp_region_type ort) t = TREE_OPERAND (t, 0); } } - while (TREE_CODE (t) == COMPONENT_REF); + while (TREE_CODE (t) == COMPONENT_REF + || TREE_CODE (t) == ARRAY_REF); if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP && OMP_CLAUSE_MAP_IMPLICIT (c) diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index ed3ecaa2a13..59c052d8eb6 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7861,7 +7861,8 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort) t = TREE_OPERAND (t, 0); } } - while (TREE_CODE (t) == COMPONENT_REF); + while (TREE_CODE (t) == COMPONENT_REF + || TREE_CODE (t) == ARRAY_REF); if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP && OMP_CLAUSE_MAP_IMPLICIT (c) diff --git a/gcc/testsuite/c-c++-common/gomp/pr103705.c b/gcc/testsuite/c-c++-common/gomp/pr103705.c new file mode 100644 index 00000000000..bf4c7066d28 --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr103705.c @@ -0,0 +1,14 @@ +/* PR c++/103705 */ +/* { dg-do compile } */ + +struct S +{ + int a[2]; +}; + +int main (void) +{ + struct S s[1]; + #pragma omp target update from(s[0].a[0:1]) + return 0; +}
reply other threads:[~2022-01-27 10:46 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=20220127104619.AC01F3945C3D@sourceware.org \ --to=cltang@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: linkBe 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).