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

            Bug ID: 100573
           Summary: [OpenMP] 'omp target teams' fails with nvptx and GCN
                    offloading: FAIL libgomp.c-c++-common/for-3.c +
                    for-9.c
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: openmp, wrong-code
          Severity: normal
          Priority: P3
         Component: libgomp
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

The testcase
  libgomp.c-c++-common/for-9.c
is a thin wrapper around libgomp.c-c++-common/for-3.c with slightly different
settings. Hence, it is affected as well.

libgomp.c-c++-common/for-3.c has:

  int err = 0;
  #pragma omp target teams reduction(|:err)
    {
       err |= test_d_normal ();
...
    }
  if (err)
    abort ();

This will currently never fail because 'err' is mapped as firstprivate to the
target – at least until PR99928 is fixed (→ patch there).

Alternatively, manually adding a 'map(tofrom: err)' also works.

However, with that 'map added or the PR99928 patch applied:
* it still PASSES on x86-64-gnu-linux (-m64, -m32) with HOST FALLBACK
* BUT it FAILS both with AMD GCN and with NVPTX offloading.

But even without reduction and by checking each of the twenty-odd testcase
separately, it FAILS. Namely, I used the following:

  int err = 0, i = 1;

  #pragma omp target teams map(tofrom: err)
    { 
      err = test_d_normal ();
    }
  __builtin_printf("%d -> %d\n", i++, err);
  err = 0;

And the result is '-> 1' for all of them.

However, when I use 'omp target' instead of 'target teams', it passes.

Reply via email to