My fixes for "declare variant", previously posted here https://gcc.gnu.org/pipermail/gcc-patches/2025-August/692306.html
have now grown to a set of 3 patches. Part 1 is a very lightly edited version of the original patch, just tweaking the wording of the "match" message and adding additional "inform" calls as suggested by Tobias in his review. Part 2 addresses the problem with the "simd" construct selector that Tobias noted, basically removing the special handling for this and fixing the testcases that have never worked properly anyway AFAICT. I opened a new issue PR121630 for this. Getting rid of the unneeded conditional introduced whitespace changes so the code changes for this look a lot hairier than they actually are. Part 3 is also new, at least partially addressing another missing-diagnostic issue PR118839 that I spotted while searching bugzilla. Sandra Loosemore (3): OpenMP: Improve front-end error-checking for "declare variant" OpenMP: Fix handling of "simd" selector on "declare variant" [PR121630] OpenMP: give error when variant is the same as the base function [PR118839] gcc/c/c-parser.cc | 342 ++++++++++-------- gcc/cp/decl.cc | 17 +- gcc/cp/parser.cc | 56 +-- gcc/fortran/openmp.cc | 8 +- gcc/fortran/trans-openmp.cc | 11 +- .../c-c++-common/gomp/append-args-1.c | 4 +- .../c-c++-common/gomp/declare-variant-5.c | 18 +- .../c-c++-common/gomp/declare-variant-7.c | 30 +- gcc/testsuite/g++.dg/gomp/adjust-args-1.C | 2 +- gcc/testsuite/g++.dg/gomp/adjust-args-3.C | 2 +- gcc/testsuite/gcc.dg/gomp/adjust-args-1.c | 2 +- gcc/testsuite/gcc.dg/gomp/append-args-1.c | 28 +- gcc/testsuite/gcc.dg/gomp/declare-variant-3.c | 18 + gcc/testsuite/gcc.dg/gomp/pr95315-2.c | 10 +- gcc/testsuite/gcc.dg/gomp/pr95315.c | 32 +- .../gcc.dg/gomp/unprototyped-variant.c | 30 ++ .../gfortran.dg/gomp/adjust-args-1.f90 | 2 +- .../gfortran.dg/gomp/append_args-1.f90 | 4 +- .../gfortran.dg/gomp/declare-variant-22.f90 | 6 + .../gfortran.dg/gomp/declare-variant-5.f90 | 6 +- .../gfortran.dg/gomp/declare-variant-7.f90 | 19 +- 21 files changed, 387 insertions(+), 260 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/gomp/declare-variant-3.c create mode 100644 gcc/testsuite/gcc.dg/gomp/unprototyped-variant.c create mode 100644 gcc/testsuite/gfortran.dg/gomp/declare-variant-22.f90 -- 2.39.5