blob: 841deb929cdda5d828a3ccf7d0abf99e741ae55c (
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
|
/* PR rtl-optimization/57003 */
/* { dg-do run { target { ! x32 } } } */
/* { dg-options "-O2" } */
#define N 2001
unsigned short *b, *c, *d;
__attribute__ ((noinline, noclone)) unsigned
bar (void)
{
asm volatile ("" : : : "memory");
return N;
}
__attribute__ ((noinline, noclone)) unsigned short *
baz (unsigned long x)
{
if (x != N * sizeof (unsigned short) + 20)
__builtin_abort ();
asm volatile ("" : : : "memory");
return d;
}
__attribute__ ((ms_abi, noinline, noclone)) void
foo (void)
{
unsigned d;
unsigned short *e;
if ((d = bar ()))
{
e = baz (d * sizeof (unsigned short) + 20);
__builtin_memcpy (e, b, d * sizeof (unsigned short));
c = e;
}
}
int
main ()
{
unsigned short a[2 * N];
int i;
for (i = 0; i < 2 * N; i++)
a[i] = i + 1;
b = a;
d = a + N;
asm volatile ("" : : : "memory");
foo ();
for (i = 0; i < N; i++)
if (a[i] != i + 1 || a[i + N] != i + 1)
__builtin_abort ();
if (c != a + N)
__builtin_abort ();
return 0;
}
|