https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68939
Bug ID: 68939
Summary: ICE or wrong code with OpenMP privatization of
reference to VLAs
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
int main ()
{
int y = 6;
int a[y - 2];
int (&c)[y - 2] = a;
c[0] = 111;
#pragma omp target private (c)
c[0] = 222;
return 0;
}
results in wrong-code being generated (use of uninitialized variable in the
outlined region for determining the size of the private c size), and in ICE
with say:
int main ()
{
int y = 6;
int a[y - 2];
int (&c)[y - 2] = a;
c[0] = 111;
#pragma omp parallel private (c)
#pragma omp single
c[0] = 222;
return 0;
}
Following is also wrong-code.
int main ()
{
int y = 6;
int a[y - 2];
typedef int T[y - 2];
T &c = a;
c[0] = 111;
#pragma omp target private (c)
c[0] = 222;
return 0;
}
I believe the problem is because of some Ada mess the gimplifier no longer
recurses in gimplify_type_sizes on REFERENCE_TYPE. Well, for all we care, it
would be enough to handle the toplevel REFERENCE_TYPE and nothing else.
But, if we can't change gimplify_type_sizes because of Ada, perhaps we should
tweak the C++ FE so that it arranges to emit a DECL_EXPR with a dummy TYPE_DECL
so that the referenced type sizes are gimplified?