https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94848
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- Also possibly related (static local device variable) are the fixed PRs, which might give a hint how to solve it (although, those look more like a band aid): * PR85063 – local variable for switch statement; solution: "Mark CSWTCH.x variable with attribute omp declare target for offloading functions." * PR84592 → see previous PR above → PR 90779 - comment 10 has: "Add "omp declare target" attributes to static block scope variables inside of target region or target functions."