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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This looks just like a bogus assumption in the testcase.
The taskloop directive says that the iterations are split into some tasks.  As
neither num_tasks nor graintsize clauses are specified, it is implementation
defined into how many tasks it is split.
But even when those would be specified, there is still no guarantee that the
master thread will execute any of those explicit threads, it can easily happen
that while the master thread creates the tasks other threads pick those tasks
already and there is no task left for the master thread.
The test should better use if (i == 0) num_threads = omp_get_num_threads();
then it has a guarantee that it will be executed exactly once.

Reply via email to