The compiler does not generate any error messages if there are more than one teams construct inside a target constructs.
#pragma omp target { #pragma omp teams { ... } #pragma omp teams { ... } }
After the fix, the error messages are issued.
teams.c:4:9: error: target construct with nested teams region contains statements outside of the teams construct #pragma omp target ^ teams.c:14:11: note: nested teams construct here #pragma omp teams ^ teams.c:9:11: note: directive outside teams construct here #pragma omp teams ^ 1 error generated.
just if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind() || OMPTeamsFound)