Committed as r16-838-gb3d07ec7ac2ccd. When adding the testcase originally in r15-6963-gfdeceba59bee60 seemingly the compile-time FAIL when nvptx offload compilation is enabled was missed.
That's now fixed by using an effective target, avoiding the FAIL. That there is an issue with such code was known, cf. PR118694. However, it looks as if there is no good way to fix this as long as it depends on knowledge available only at runtime as 'target' is executed differently when there is a 'teams' available from when it isn't. Tobias PS: I intent to cherry-pick this to GCC 15 shortly.