| 1 |
/* PR c/47931 - missing -Waddress warning for comparison with NULL |
| 2 |
{ dg-do compile } |
| 3 |
{ dg-options "-Waddress" } */ |
| 4 |
|
| 5 |
#define NULL ((void *) 0) |
| 6 |
|
| 7 |
int i; |
| 8 |
|
| 9 |
int f0 (void) |
| 10 |
{ |
| 11 |
return &i != 0; /* { dg-warning "the address of .i. will never be NULL" } */ |
| 12 |
} |
| 13 |
|
| 14 |
int f1 (void) |
| 15 |
{ |
| 16 |
return &i != (void *) 0; /* { dg-warning "the address of .i. will never be NULL" } */ |
| 17 |
} |
| 18 |
|
| 19 |
int f2 (void) |
| 20 |
{ |
| 21 |
return &i != NULL; /* { dg-warning "the address of .i. will never be NULL" } */ |
| 22 |
} |