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
|
/* PR debug/43051 */
/* { dg-do run } */
/* { dg-options "-g" } */
extern void abort (void);
static void __attribute__ ((noinline))
foo (const char *x, long long y, int z)
{
asm volatile ("" : : "r" (x), "r" ((int) y), "r" (z) : "memory");
}
struct S
{
struct S *n;
int v;
};
struct S a[10];
struct S * __attribute__ ((noinline))
bar (struct S *c, int v, struct S *e)
{
#ifdef __i386__
register int si asm ("esi"), di asm ("edi"), bx
# if !defined (__pic__) && !defined (__APPLE__)
asm ("ebx")
# endif
;
asm volatile ("" : "=r" (si), "=r" (di), "=r" (bx));
#endif
while (c < e)
{
foo ("c", (__UINTPTR_TYPE__) c, 0); /* { dg-final { gdb-test 34 "c" "\&a\[0\]" } } */
foo ("v", v, 1); /* { dg-final { gdb-test 35 "v" "1" } } */
foo ("e", (__UINTPTR_TYPE__) e, 2); /* { dg-final { gdb-test 36 "e" "\&a\[1\]" } } */
if (c->v == v)
return c;
foo ("c", (__UINTPTR_TYPE__) c, 3); /* { dg-final { gdb-test 39 "c" "\&a\[0\]" } } */
foo ("v", v, 4); /* { dg-final { gdb-test 40 "v" "1" } } */
foo ("e", (__UINTPTR_TYPE__) e, 5); /* { dg-final { gdb-test 41 "e" "\&a\[1\]" } } */
c++;
}
#ifdef __i386__
asm volatile ("" : : "r" (si), "r" (di), "r" (bx));
#endif
return 0;
}
int
main ()
{
asm volatile ("" : : "r" (&a[0]) : "memory");
if (bar (&a[a[0].v], a[0].v + 1, &a[a[0].v + 1]))
abort ();
return 0;
}
|