On Wed, Oct 07, 2026 at 01:51:19PM +0100, [email protected] wrote:
> libgomp/ChangeLog:
>
> * testsuite/libgomp.c/artificial-team-pause.c: New test.
> * testsuite/libgomp.c/barrier-copyprivate-task.c: New test.
> * testsuite/libgomp.c/barrier-nested-team-id.c: New test.
> * testsuite/libgomp.c/barrier-task-reduction.c: New test.
> * testsuite/libgomp.c/barrier-tree-flush.c: New test.
> * testsuite/libgomp.c/barrier-tree-task.c: New test.
> * testsuite/libgomp.c/barrier-workshare-task.c: New test.
> * testsuite/libgomp.c/cancel-late-arrival-1.c: New test.
> * testsuite/libgomp.c/cancel-late-arrival-2.c: New test.
> * testsuite/libgomp.c/cancel-late-arrival.h: Header for new tests.
> * testsuite/libgomp.c/cancel-next-epoch-wrap.c: New test.
> * testsuite/libgomp.c/team-held-pause.c: New test.
> * testsuite/libgomp.c/team-held-pthread-exit.c: New test.
LGTM with nits. I have skimmed through and don't see anything wrong with
those tests, so why not.
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.c/barrier-copyprivate-task.c
> +#pragma omp parallel num_threads(nthreads) \
> + shared(state, nthreads, epoch, first_winner, second_winner, \
> + first_value, second_value)
Formatting, like in the 2nd patch, this just should use tabs where possible
and \s should be aligned.
> + {
> + int tid = omp_get_thread_num ();
> + long long copied = -1;
> +
> + if (tid == first_winner)
> + {
> + for (int task = 0; task < tasks; ++task)
> + {
> +#pragma omp task firstprivate(task) shared(state, epoch)
I'd say epoch should be firstprivate instead of shared, it is a scalar
which is never modified in the task.
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.c/barrier-nested-team-id.c
> + for (int round = 0; round < rounds; ++round)
> + {
> + int loop_total = 0;
> + int task_total = 0;
> +
> +#pragma omp parallel num_threads(3) shared(loop_total, task_total, round)
Similarly, why isn't round firstprivate?
> + {
> + int outer_id = omp_get_thread_num ();
> +
> + if (outer_id == 1)
> + {
> + int inner_threads = 2 + round % 4;
> +
> +#pragma omp parallel num_threads(inner_threads) \
Again, spaces instead of tabs.
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.c/barrier-tree-flush.c
> +#pragma omp parallel num_threads(nthreads) shared(nthreads, epoch)
Again, why not firstprivate(nthreads, epoch)?
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.c/barrier-tree-task.c
> +#pragma omp parallel num_threads(8) \
Again. Or in these cases where there is just one \ just put a single
space after the last clause on the line and then \
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.c/barrier-workshare-task.c
> +#pragma omp parallel num_threads(nthreads) shared(state, nthreads, epoch)
See above for firstprivate (nthreads, epoch).
> + {
> +#pragma omp single nowait
> + for (int task = 0; task < tasks; ++task)
> + {
> +#pragma omp task firstprivate(task) shared(state, epoch)
Similarly, firstprivate (epoch).
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.c/cancel-late-arrival-1.c
> @@ -0,0 +1,8 @@
> +/* Verify late arrival at an already-cancelled flat barrier. The shared
> + implementation also follows each cancellation with a plain barrier so a
> + checking runtime validates the rolled-forward local generations. */
> +/* { dg-do run { target linux_futex_waitv } } */
> +/* { dg-set-target-env-var OMP_CANCELLATION "true" } */
> +/* { dg-set-target-env-var GOMP_BARRIER_TYPE "flat" } */
> +
> +#include "cancel-late-arrival.h"
The normal gcc way of doing testcases when you want to run the same test
multiple times with different env vars, options etc. is to put the
whole thing into one of the testcases and then include the whole
test in another one, instead of adding an artificial header with everything
including main in it.
So, manually include all of cancel-late-arrival.h here.
> diff --git a/libgomp/testsuite/libgomp.c/cancel-late-arrival-2.c
> b/libgomp/testsuite/libgomp.c/cancel-late-arrival-2.c
> new file mode 100644
> index 00000000000..b41bdda938d
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.c/cancel-late-arrival-2.c
> @@ -0,0 +1,8 @@
> +/* Verify late arrival at an already-cancelled tree barrier. This runs the
> + same controlled cancellation and checking-barrier sequence as the flat
> + variant while selecting the tree arrival protocol. */
> +/* { dg-do run { target linux_futex_waitv } } */
> +/* { dg-set-target-env-var OMP_CANCELLATION "true" } */
> +/* { dg-set-target-env-var GOMP_BARRIER_TYPE "tree" } */
> +
> +#include "cancel-late-arrival.h"
And change this to
#include "cancel-late-arrival-1.c"
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.c/cancel-late-arrival.h
And remove this.
Jakub