From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id EC8ED3948A7D; Tue, 6 Sep 2022 07:23:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EC8ED3948A7D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662449029; bh=FF+xLd5osEVmTDQVnk53kwWWV2/nVZ0YGNGp4J8r8dw=; h=From:To:Subject:Date:From; b=Ogz6hCPa3HSU1lH+lp/rlkl7Nlx3RzPeGcPqVNXxzC0vumMxDwLIfi/yHmcGnKvAh 46tNpbE9meAtjQBRyOqwy+Zu/BiPBbTUfrzVukej8fcgVpKM7AB2+KK4llRlOIYzue sKKFl36ArZ7S77E3wxIVlgInn8ctX52xTK313kR4= 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-2489] openmp: Fix ICE when splitting invalid depend(source)/depend(sink:vec) X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: bc1bc808d860c013318a3f126dc69cb894cb3e11 X-Git-Newrev: 1bf8b7adc2de6f2ddaffa3af131b6855ae3e3793 Message-Id: <20220906072349.EC8ED3948A7D@sourceware.org> Date: Tue, 6 Sep 2022 07:23:49 +0000 (GMT) List-Id: https://gcc.gnu.org/g:1bf8b7adc2de6f2ddaffa3af131b6855ae3e3793 commit r13-2489-g1bf8b7adc2de6f2ddaffa3af131b6855ae3e3793 Author: Jakub Jelinek Date: Tue Sep 6 09:21:10 2022 +0200 openmp: Fix ICE when splitting invalid depend(source)/depend(sink:vec) As we now create OMP_CLAUSE_DOACROSS rather than OMP_CLAUSE_DEPEND when depend is used with source/sink modifiers, c_omp_split_clauses can see OMP_CLAUSE_DOACROSS clause too before we diagnose it as erroneous. The following patch treats it like OMP_CLAUSE_DEPEND during the splitting but adds an assertion. 2022-09-06 Jakub Jelinek PR c/106836 * c-omp.cc (c_omp_split_clauses): Handle OMP_CLAUSE_DOACROSS. * c-c++-common/gomp/pr106836.c: New test. Diff: --- gcc/c-family/c-omp.cc | 6 ++++++ gcc/testsuite/c-c++-common/gomp/pr106836.c | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/gcc/c-family/c-omp.cc b/gcc/c-family/c-omp.cc index 56bc4b1bfef..1b086d80581 100644 --- a/gcc/c-family/c-omp.cc +++ b/gcc/c-family/c-omp.cc @@ -1877,6 +1877,12 @@ c_omp_split_clauses (location_t loc, enum tree_code code, case OMP_CLAUSE_DEPEND: s = C_OMP_CLAUSE_SPLIT_TARGET; break; + case OMP_CLAUSE_DOACROSS: + /* This can happen with invalid depend(source) or + depend(sink:vec) on target combined with other constructs. */ + gcc_assert (OMP_CLAUSE_DOACROSS_DEPEND (clauses)); + s = C_OMP_CLAUSE_SPLIT_TARGET; + break; case OMP_CLAUSE_NUM_TEAMS: s = C_OMP_CLAUSE_SPLIT_TEAMS; break; diff --git a/gcc/testsuite/c-c++-common/gomp/pr106836.c b/gcc/testsuite/c-c++-common/gomp/pr106836.c new file mode 100644 index 00000000000..6df8250f81c --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/pr106836.c @@ -0,0 +1,9 @@ +/* PR c/106836 */ + +void +foo (void) +{ +#pragma omp target parallel depend (source) /* { dg-error "'depend\\\(source\\\)' is only allowed in 'omp ordered'" } */ + ; +#pragma omp taskwait +}