On Tue, Feb 13, 2024 at 03:54:28PM +0100, Tobias Burnus wrote: > Inomp_resolve_declare_variant, a code path generates a new decl for the base > function – in doing so, it ignores the assembler name. As the included > Fortran example shows, this will lead to a linker error. Solution: Also copy > over the assembler name. Comments, suggestions, remarks before I commit it? > Tobias PS: As a fallout of some testing, motivated by the original testcase, > I have filled a couple of declare-variant and context-selector PRs: 113904 > (dyn. user={condition(...)}), 113905 (multiple users of variant funcs), > 113906 (construct={...} lacks constructs).
> OpenMP: Handle DECL_ASSEMBLER_NAME with 'declare variant' > > gcc/ChangeLog: > > * omp-general.cc (omp_resolve_declare_variant): When building the decl > for the base variant, honor also the assembler name. That artificial function I believe should never be emitted, neither it nor calls to it, so it shouldn't matter what DECL_ASSEMBLER_NAME it has. Isn't all this caused just by the missing check that condition trait has a constant expression? IMHO that is the way to handle it in GCC 14. Once middle-end has support for the dynamic conditions, it again should handle it properly, never resolve to the artificial one, but figure out what variants are possible given the unknown state of conditions, what scores they have and depending on that figure out what checks to perform at runtime to find out which function should be called in each case. It can get quite a bit complicated with lots of possible functions and lots of different score values. Jakub