https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103416
--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> --- Okay, the map(to:D.4217 [len: 4][implicit]) map(tofrom:n [len: 4][implicit]) issue is not new – only the '[implicit]' + the misaligned address one (fixed by the patch from comment 1). * * * Thus regression → comment 1 *** And extra map(to:D.4217) – this occurs already with GCC 11 and is, thus, not a regression. (Only '[implicit]' is new.) This seems to be due to a scope issue. In gimplify_omp_for (gdb) p debug(for_stmt) #pragma omp for nowait for (i0 = 1; i0 <= D.4217; i0 = i0 + 1) REALPART_EXPR <scalar> = (real(kind=8)) n; which then calls at some point omp_notice_variable ( debug_tree(decl) which ends up with 7698 nflags |= GOVD_MAP | GOVD_MAP_TO_ONLY; The problem is that here integer(kind=4) D.3933; is generated in the parent scope of '#omp target' instead of in the parent scope of '#omp parallel do'. Thus, there are two questions: * Why is 'map(to:' and not 'firstprivate' used? * Why is the var generated in the parent scope of 'omp target' instead of inside 'omp target'?