https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69555
Bug ID: 69555 Summary: libgomp.c++/target-6.C fails because of undefined behaviour Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: vogt at linux dot vnet.ibm.com CC: jakub at gcc dot gnu.org, krebbel at gcc dot gnu.org Target Milestone: --- Target: s390x The test case libgomp.c++/target-6.C fails on s390x, and I think that's because it uses a reference type variable in a "private" construct: -- snip -- ... int a[y - 2], b[y - 2]; int (&c)[y - 2] = a, (&d)[y - 2] = b; ^^^^^^^^^^^^^^^ ... #pragma omp target private (x, u, s, c, i) firstprivate (y, v, t, d) map(from\ :err) ^^^ { ... for (i = 0; i < y - 2; i++) c[i] = d[i]; ... } ... -- snip -- Depending on optimisations and the rest of the code, this leads to either incorrect values in the array "a" or accessing a pointer to random memory. As far as I understand it, the "OpenMP Application Program Interface, Version 4.0 - July 2013" explicitly forbids this on page 161: 28 • A variable that appears in a private clause must not have an incomplete type or a 29 reference type.