https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99226
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> This is invalid and should have been rejected, when teams is nested in
> target, it must be the only thing nested in it, you can't have two teams
> directives nested in one target construct.
How is this enforceable at compile time for '!$omp target; call f(); call g()"
and then in f() and g() the teams?
The following C program compiles – without ICE and without error:
void
sub (int n)
{
int i;
#pragma omp target
{
#pragma omp teams distribute dist_schedule (static,n+4)
for (i = 0; i < 8; ++i)
;
#pragma omp teams distribute dist_schedule (static,n+4)
for (i = 0; i < 8; ++i)
;
}
}
And the resulting omplower dump is:
#pragma omp teams shared(n)
__builtin_GOMP_teams (0, 0);
{
D.2077 = n + 4;
{
int i;
#pragma omp distribute dist_schedule(static,D.2077) private(i)
for (i = 0; i < 8; i = i + 1)
#pragma omp continue (i, i)
#pragma omp return(nowait)
}
}
#pragma omp return(nowait)
while for Fortran the dump is
#pragma omp teams shared(n)
__builtin_GOMP_teams (0, 0);
{
{
integer(kind=4) D.3932;
D.3936 = *n;
D.3932 = D.3936 + 4;
{
integer(kind=4) i;
#pragma omp distribute dist_schedule(static,D.3932)
private(i)
for (i = 1; i <= 8; i = i + 1)
<D.3945>:
#pragma omp continue (i, i)
#pragma omp return(nowait)
}
}
}
#pragma omp return(nowait)