https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101535
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- void foo (void) { int a = 1, i; #pragma omp target data map(to:a) #pragma omp for lastprivate(i) for (i = 1; i < 2; i++) ; } ICEs too. With the target data directive commented out it is diagnosed: lastprivate variable āiā is private in outer context so I think we should make sure we don't consider the target data affecting it in any way.