Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/pr49279.c

raw
1 /* PR tree-optimization/49279 */
2 extern void abort (void);
3
4 struct S { int a; int *__restrict p; };
5
6 __attribute__((noinline, noclone))
7 struct S *bar (struct S *p)
8 {
9 struct S *r;
10 asm volatile ("" : "=r" (r) : "0" (p) : "memory");
11 return r;
12 }
13
14 __attribute__((noinline, noclone))
15 int
16 foo (int *p, int *q)
17 {
18 struct S s, *t;
19 s.a = 1;
20 s.p = p;
21 t = bar (&s);
22 t->p = q;
23 s.p[0] = 0;
24 t->p[0] = 1;
25 return s.p[0];
26 }
27
28 int
29 main ()
30 {
31 int a, b;
32 if (foo (&a, &b) != 1)
33 abort ();
34 return 0;
35 }