Debian Codegraph @

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

raw
1 int i;
2 struct X {
3 int *p;
4 };
5 struct X * __attribute__((malloc))
6 my_alloc (void)
7 {
8 struct X *p = __builtin_malloc (sizeof (struct X));
9 p->p = &i;
10 return p;
11 }
12 extern void abort (void);
13 int main()
14 {
15 struct X *p, *q;
16 p = my_alloc ();
17 q = my_alloc ();
18 *(p->p) = 1;
19 *(q->p) = 0;
20 if (*(p->p) != 0)
21 abort ();
22 return 0;
23 }