111
|
1 /* GCC was not warning about taking the address of parameters or
|
|
2 fields of struct parameters when returning them. */
|
|
3 /* PR c/14156 */
|
|
4
|
|
5 /* { dg-do compile } */
|
|
6
|
|
7
|
|
8 int * f( int a)
|
|
9 {
|
|
10 return &a;/* { dg-warning "address" } */
|
|
11 }
|
|
12
|
|
13 int * g()
|
|
14 {
|
|
15 int b = 0;
|
|
16 return &b;/* { dg-warning "address" } */
|
|
17 }
|
|
18
|
|
19 struct ll
|
|
20 {
|
|
21 int i;
|
|
22 };
|
|
23
|
|
24 int *h(struct ll c)
|
|
25 {
|
|
26 return &c.i;/* { dg-warning "address" } */
|
|
27 }
|
|
28
|
|
29
|
|
30 struct ll d;
|
|
31
|
|
32 int *i()
|
|
33 {
|
|
34 return &d.i;/* { dg-bogus "address" } */
|
|
35 }
|
|
36
|
|
37
|
|
38 int *j(struct ll *c)
|
|
39 {
|
|
40 return &c->i; /* { dg-bogus "address" } */
|
|
41 }
|