1 /* PR c/71924 - missing -Wreturn-local-addr returning alloca result
3 { dg-options "-O2 -Wall" } */
9 char a
[32]; /* { dg-message "declared here" } */
15 for (i
= 0; i
!= 32; ++i
)
19 p
= i
< 32 ? &p
[i
] : 0;
20 return p
; /* { dg-warning "may return address of local variable" } */
24 void* loop_ptr (int i
, int x
)
26 char a
[32]; /* { dg-message "declared here" } */
31 /* The warning for the statement below would ideally be a "returns"
32 because it definitely returns the address of a, but when both
33 returns get merged into one we end up with a "may return". */
36 return p
; /* { dg-warning "(returns|may return) address of local variable" "missing location" { xfail *-*-* } } */
37 /* { dg-warning "(returns|may return) address of local variable" "pr90735" { target *-*-* } 0 } */