https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115574
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- > #pragma declare target link(a,b) as Thomas pointed out (cf. comment 1), an 'omp' is missing. It also lacks, e.g. '#pragma omp target enter data map(a, b)' to be valid. Still, the real issue is '!is_global_var (t)' which is only valid if there is no nested function which is 'declare target', as that can access the static variable through the backdoor.