testsuite: Skip analyzer tests on AIX.
[official-gcc.git] / gcc / testsuite / c-c++-common / Wreturn-local-addr.c
blobc8c3b9002912c9cc12ba093d6eb512b9a88c8f31
1 /* PR c/90737 - inconsistent address of a local converted to intptr_t
2 between callee and caller
3 { dg-do compile }
4 { dg-options "-O1 -Wall -Wreturn-local-addr -fdump-tree-optimized" } */
6 typedef __INTPTR_TYPE__ intptr_t;
8 static inline intptr_t
9 return_addr_local_as_int (void)
11 int i;
12 if ((intptr_t)&i == 0)
13 __builtin_abort ();
15 return (intptr_t)&i;
18 void get_addr_local_as_int (void)
20 intptr_t i = return_addr_local_as_int ();
21 if (i == 0)
22 __builtin_abort ();
26 static inline intptr_t
27 return_addr_label_as_int (void)
29 label:
30 if ((intptr_t)&&label == 0)
31 __builtin_abort ();
33 return (intptr_t)&&label;
36 void get_addr_label_as_int (void)
38 intptr_t i = return_addr_label_as_int ();
39 if (i == 0)
40 __builtin_abort ();
43 /* Verify that the functions that return the address of the label
44 or local variable have been optimized away and so have the calls
45 to abort.
46 { dg-final { scan-tree-dump-not "return_addr_" "optimized" } }
47 { dg-final { scan-tree-dump-not "abort" "optimized" } } */