From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id A5F413AA8C77; Tue, 20 Apr 2021 23:30:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A5F413AA8C77 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 r9-9396] openmp: Avoid ICE on depend clause on depobj OpenMP construct [PR98072] X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/releases/gcc-9 X-Git-Oldrev: 4b35e830e7161cd6a453a26c7c4407b477311e65 X-Git-Newrev: 705afe9b40aabbe395baa2979cdac0a9fef194ef Message-Id: <20210420233021.A5F413AA8C77@sourceware.org> Date: Tue, 20 Apr 2021 23:30:21 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Apr 2021 23:30:21 -0000 https://gcc.gnu.org/g:705afe9b40aabbe395baa2979cdac0a9fef194ef commit r9-9396-g705afe9b40aabbe395baa2979cdac0a9fef194ef Author: Jakub Jelinek 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 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]) +}