]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP: Check additional restrictions on context selector properties
authorSandra Loosemore <sloosemore@baylibre.com>
Fri, 6 Sep 2024 20:58:13 +0000 (20:58 +0000)
committerSandra Loosemore <sloosemore@baylibre.com>
Tue, 24 Sep 2024 15:04:08 +0000 (15:04 +0000)
commit96246bff0bcd9e5cdec9e6cf811ee3db4997f6d4
treed41609ae565965c5a885121ac658efd8fb0fca49
parent2114243c23ec5168cd54633cd4995ab123d92573
OpenMP: Check additional restrictions on context selector properties

TR13 (pre-6.0) of the OpenMP spec says:

"Each trait-property may only be specified once in a trait selector
other than those in the construct selector set."

and

"If trait-property any is specified in the kind trait-selector of the
device selector set or the target_device selector sets, no other
trait-property may be specified in the same selector set."

These restrictions (with slightly different wording) date back to
OpenMP 5.1, but were not in 5.0 which was the basis for GCC's
implementation.

This patch adds a diagnostic, adds new testcases, and fixes some older
testcases that include now-invalid selectors.

gcc/ChangeLog
* omp-general.cc (omp_check_context_selector): Reject other
properties in the same selector set with kind(any).  Also reject
duplicate name-list properties.

gcc/testsuite/ChangeLog
* c-c++-common/gomp/declare-variant-10.c: Fix broken tests.
* c-c++-common/gomp/declare-variant-3.c: Likewise.
* c-c++-common/gomp/declare-variant-9.c: Likewise.
* c-c++-common/gomp/declare-variant-any.c: New.
* c-c++-common/gomp/declare-variant-duplicates.c: New.
* gfortran.dg/gomp/declare-variant-10.f90: Fix broken tests.
* gfortran.dg/gomp/declare-variant-3.f90: Likewise.
* gfortran.dg/gomp/declare-variant-9.f90: Likewise.
* gfortran.dg/gomp/declare-variant-any.f90: New.
* gfortran.dg/gomp/declare-variant-duplicates.f90: New.
gcc/omp-general.cc
gcc/testsuite/c-c++-common/gomp/declare-variant-10.c
gcc/testsuite/c-c++-common/gomp/declare-variant-3.c
gcc/testsuite/c-c++-common/gomp/declare-variant-9.c
gcc/testsuite/c-c++-common/gomp/declare-variant-any.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/gomp/declare-variant-duplicates.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/declare-variant-10.f90
gcc/testsuite/gfortran.dg/gomp/declare-variant-3.f90
gcc/testsuite/gfortran.dg/gomp/declare-variant-9.f90
gcc/testsuite/gfortran.dg/gomp/declare-variant-any.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/declare-variant-duplicates.f90 [new file with mode: 0644]