[Bug middle-end/86542] New: wrong-code for collapsed taskloop which needs omp_cpyfn

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 17 07:57:00 GMT 2018


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

            Bug ID: 86542
           Summary: wrong-code for collapsed taskloop which needs
                    omp_cpyfn
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

When a collapsed taskloop (collapse (2) and above) needs a cpyfn callback (e.g.
firstprivatization of non-POD variable), the generated cpyfn doesn't copy data
corresponding to _looptemp_ clauses (the first two are filled in by
GOMP_taskloop*, but the other ones need to be copied).

struct S { int s; S (); ~S (); S (const S &); };
S s;

S::S ()
{
}

S::~S ()
{
}

S::S (const S &x)
{
  s = x.s;
}

__attribute__((noipa)) void
foo (int i, int j, int k, S s)
{
  if (i != 0 || j != 0 || k != 0 || s.s != 12)
    __builtin_abort ();
}

int
main ()
{
  volatile int inc = 16, jnc = 16, knc = 16;
  s.s = 12;
  #pragma omp taskloop collapse (3) firstprivate (s)
  for (int i = 0; i < 16; i += inc)
    for (int j = 0; j < 16; j += jnc)
      for (int k = 0; k < 16; k += knc)
        foo (i, j, k, s);
  return 0;
}

fails with -fopenmp at runtime with:
Floating point exception (core dumped)
136


More information about the Gcc-bugs mailing list