https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118457
--- Comment #3 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Sandra Loosemore <san...@gcc.gnu.org>: https://gcc.gnu.org/g:44b1d52e2f4db57849ca54b63c52a687294b1793 commit r15-7911-g44b1d52e2f4db57849ca54b63c52a687294b1793 Author: Sandra Loosemore <sloosem...@baylibre.com> Date: Sun Mar 9 01:50:19 2025 +0000 OpenMP: Integrate dynamic selectors with dispatch argument handling [PR118457] Support for dynamic selectors in "declare variant" was developed in parallel with support for the adjust_args/append_args clauses and the dispatch construct; they collided in a bad way. This patch fixes the "sorry" for calls that need both by removing the adjust_args/append_args code from gimplify_call_expr and invoking it from the new variant substitution code instead. It's handled as a tree -> tree transformation rather than tree -> gimple because eventually this code may end up being invoked from the front ends instead of the gimplifier (see PR115076). gcc/ChangeLog PR middle-end/118457 * gimplify.cc (modify_call_for_omp_dispatch): New, containing code split from gimplify_call_expr and modified to emit tree instead of gimple. Remove the error for falling through to a call to the base function. (expand_variant_call_expr): New, split from gimplify_variant_call_expr. Call modify_call_for_omp_dispatch on calls to variants in a dispatch construct context. (gimplify_variant_call_expr): Make it call expand_variant_call_expr to do the actual work. (gimplify_call_expr): Remove sorry for calls involving both dynamic/late selectors and adjust_args/append_args, and adjust for new interface. Move adjust_args/append_args code to modify_call_for_omp_dispatch. (gimplify_omp_dispatch): Add some comments. gcc/testsuite/ChangeLog PR middle-end/118457 * c-c++-common/gomp/adjust-args-6.c: Remove xfails and adjust expected output. * c-c++-common/gomp/append-args-5.c: Adjust expected output. * c-c++-common/gomp/append-args-dynamic.c: New. * c-c++-common/gomp/dispatch-11.c: Adjust expected output. * gfortran.dg/gomp/dispatch-11.f90: Likewise.