PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / guality / pr43051-1.c
blob77325c97e268658d842c849f180fb37edb3f096d
1 /* PR debug/43051 */
2 /* { dg-do run } */
3 /* { dg-options "-g" } */
5 extern void abort (void);
7 static void __attribute__ ((noinline))
8 foo (const char *x, long long y, int z)
10 asm volatile ("" : : "r" (x), "r" ((int) y), "r" (z) : "memory");
13 struct S
15 struct S *n;
16 int v;
19 struct S a[10];
21 struct S * __attribute__ ((noinline))
22 bar (struct S *c, int v, struct S *e)
24 #ifdef __i386__
25 register int si asm ("esi"), di asm ("edi"), bx
26 # if !defined (__pic__) && !defined (__APPLE__)
27 asm ("ebx")
28 # endif
30 asm volatile ("" : "=r" (si), "=r" (di), "=r" (bx));
31 #endif
32 while (c < e)
34 foo ("c", (__UINTPTR_TYPE__) c, 0); /* { dg-final { gdb-test 34 "c" "\&a\[0\]" } } */
35 foo ("v", v, 1); /* { dg-final { gdb-test 35 "v" "1" } } */
36 foo ("e", (__UINTPTR_TYPE__) e, 2); /* { dg-final { gdb-test 36 "e" "\&a\[1\]" } } */
37 if (c->v == v)
38 return c;
39 foo ("c", (__UINTPTR_TYPE__) c, 3); /* { dg-final { gdb-test 39 "c" "\&a\[0\]" } } */
40 foo ("v", v, 4); /* { dg-final { gdb-test 40 "v" "1" } } */
41 foo ("e", (__UINTPTR_TYPE__) e, 5); /* { dg-final { gdb-test 41 "e" "\&a\[1\]" } } */
42 c++;
44 #ifdef __i386__
45 asm volatile ("" : : "r" (si), "r" (di), "r" (bx));
46 #endif
47 return 0;
50 int
51 main ()
53 asm volatile ("" : : "r" (&a[0]) : "memory");
54 if (bar (&a[a[0].v], a[0].v + 1, &a[a[0].v + 1]))
55 abort ();
56 return 0;