da3d46cba8
PR libgomp/69555 * gimplify.c (gimplify_decl_expr): For decls with REFERENCE_TYPE, also gimplify_type_sizes the type they refer to. (omp_notice_variable): Handle reference vars to VLAs. * omp-low.c (lower_omp_target): Emit setup of OMP_CLAUSE_PRIVATE reference to VLA decls in the second pass instead of first pass. * testsuite/libgomp.c++/pr69555-1.C: New test. * testsuite/libgomp.c++/pr69555-2.C: New test. From-SVN: r233913
59 lines
1.0 KiB
C
59 lines
1.0 KiB
C
// PR libgomp/69555
|
|
// { dg-do run }
|
|
|
|
__attribute__((noinline, noclone)) void
|
|
f1 (int y)
|
|
{
|
|
int a[y - 2];
|
|
int (&c)[y - 2] = a;
|
|
for (int i = 0; i < y - 2; i++)
|
|
c[i] = i + 4;
|
|
|
|
#pragma omp target firstprivate (c)
|
|
{
|
|
for (int i = 0; i < y - 2; i++)
|
|
{
|
|
if (c[i] != i + 4)
|
|
__builtin_abort ();
|
|
c[i] = i + 9;
|
|
}
|
|
asm volatile ("" : : "r" (&c[0]) : "memory");
|
|
for (int i = 0; i < y - 2; i++)
|
|
if (c[i] != i + 9)
|
|
__builtin_abort ();
|
|
}
|
|
for (int i = 0; i < y - 2; i++)
|
|
if (c[i] != i + 4)
|
|
__builtin_abort ();
|
|
}
|
|
|
|
__attribute__((noinline, noclone)) void
|
|
f2 (int y)
|
|
{
|
|
int a[y - 2];
|
|
int (&c)[y - 2] = a;
|
|
for (int i = 0; i < y - 2; i++)
|
|
c[i] = i + 4;
|
|
|
|
#pragma omp target private (c)
|
|
{
|
|
for (int i = 0; i < y - 2; i++)
|
|
c[i] = i + 9;
|
|
asm volatile ("" : : "r" (&c[0]) : "memory");
|
|
for (int i = 0; i < y - 2; i++)
|
|
if (c[i] != i + 9)
|
|
__builtin_abort ();
|
|
}
|
|
for (int i = 0; i < y - 2; i++)
|
|
if (c[i] != i + 4)
|
|
__builtin_abort ();
|
|
}
|
|
|
|
int
|
|
main ()
|
|
{
|
|
f1 (6);
|
|
f2 (6);
|
|
return 0;
|
|
}
|