| 1 |
extern void unknown_returns (const char *p); |
| 2 |
extern void unknown_noreturn (const char *p) __attribute__((__noreturn__)); |
| 3 |
|
| 4 |
void test_1 (const char *p) |
| 5 |
{ |
| 6 |
if (p) |
| 7 |
unknown_returns (p); |
| 8 |
__builtin_strcmp ("a", p); /* { dg-message "pointer 'p' is dereferenced here" "" { target c } } */ |
| 9 |
if (p) /* { dg-warning "check of 'p' for NULL after already dereferencing it" "" { target c } } */ |
| 10 |
unknown_returns (p); |
| 11 |
__builtin_strcmp ("a", p); |
| 12 |
} |
| 13 |
|
| 14 |
void test_2 (const char *p) |
| 15 |
{ |
| 16 |
if (p) |
| 17 |
unknown_noreturn (p); |
| 18 |
__builtin_strcmp ("a", p); |
| 19 |
if (p) /* { dg-bogus "check of 'p' for NULL after already dereferencing it" } */ |
| 20 |
unknown_noreturn (p); |
| 21 |
__builtin_strcmp ("a", p); |
| 22 |
} |