https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92568
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I don't think the TARGET attribute ever matters for the mapping rules. What matters is whether a variable is mentioned in !$omp declare target to/link clauses (for OpenMP 5 there is also some implicit discovery for that). And, while err has TARGET attribute, it isn't mentioned in !$omp declare target, so it should be firstprivate.