OSDN Git Service

PR tree-optimization/52019
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / guality / asm-1.c
1 /* { dg-do run } */
2 /* { dg-options "-g" } */
3
4 #include "../nop.h"
5
6 struct A { int x; unsigned short y; char z[64]; };
7
8 void __attribute__((noinline))
9 foo (struct A *p, char *q)
10 {
11   int f = &p->z[p->y] - q;
12   asm volatile (NOP);
13   asm volatile (NOP : : "g" (f));               /* { dg-final { gdb-test 14 "f" "14" } } */
14   asm volatile ("" : : "g" (p), "g" (q));
15 }
16
17 int
18 main ()
19 {
20   struct A a;
21   __builtin_memset (&a, 0, sizeof a);
22   a.y = 26;
23   a.x = 12;
24   asm volatile ("" : : "r" (&a) : "memory");
25   foo (&a, &a.z[a.x]);
26   return 0;
27 }