https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97212

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I believe the testcase is invalid.
As the explicit task doesn't have if(false) clause, the task isn't undeferred,
so it is up to the implementation whether it waits for its completion or just
continues (defers it).  And there is no task synchronization point before the
if (sum != N) __builtin_abort (); statement, so if the implementation decides
to defer it, then there is no guarantee it completes before that statement.
Without the target nowait task gcc wouldn't defer it because there is just an
implicit parallel region rather than explicit (e.g. if you add parallel
num_threads(1) around most of main and change target nowait to task, you'd get
the same behavior), but in order to support async target tasks we do create
intentionally a team and thus defer the task.
So, the testcase needs something like
#pragma omp taskwait
or taskwait with depend or add if(false) to the task.

Reply via email to