blob: 78776ea7c9e1fed804183f9e4217678ff447386d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
// 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;
}
|