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

            Bug ID: 101899
           Summary: [OpenMP] Wrong results with !$omp taskloop – but only
                    in Fortran version
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: openmp, wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

Created attachment 51300
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51300&action=edit
Testcase – gfortran -fopenmp test.f90

This is based on the Fortranized testcase of 
libgomp/testsuite/libgomp.c-c++-common/masked-1.c

The result for the program in this PR is the same with GCC 10, 11 and current
mainline.

With 'omp taskloop' commented, the program fills
the array 'a' with [0, 1, ..., 127].

However, with 'omp taskloop', the final result is '0' for all array elements.

Looking at the output of
        a(i) = a(i) + i
        print *, i, a(i), omp_get_thread_num ()
in the taskloop shows:
         123         123           0
         124         124           0
         125         125           0
         126         126           0
         127         127           0
          64          64           2
          65          65           2
...
          76          76           2
           0           0           1
           1           1           1
           2           2           1
Thus, inside the loop, it is correctly set – but after the taskloop (also
inside 'omp master'), a(:) == 0.

Reply via email to