| 1 |
/* Fixed in r7-2945-g61f46d0e6dd568. |
| 2 |
Simplified from gcc/ipa-devirt.c. */ |
| 3 |
|
| 4 |
#include "../../gcc.dg/analyzer/analyzer-decls.h" |
| 5 |
|
| 6 |
|
| 7 |
typedef struct odr_type_d { |
| 8 |
/* .... */ |
| 9 |
int id; |
| 10 |
/* .... */ |
| 11 |
} *odr_type; |
| 12 |
static odr_type **odr_types_ptr; |
| 13 |
#define odr_types (*odr_types_ptr) /* { dg-message "pointer 'odr_types_ptr' is dereferenced here" } */ |
| 14 |
|
| 15 |
int cond, other_cond; |
| 16 |
|
| 17 |
odr_type some_logic (); |
| 18 |
|
| 19 |
odr_type |
| 20 |
get_odr_type (/* ... */) |
| 21 |
{ |
| 22 |
/* .... */ |
| 23 |
odr_type val = NULL; |
| 24 |
/* .... */ |
| 25 |
|
| 26 |
val = some_logic (); |
| 27 |
|
| 28 |
/* .... */ |
| 29 |
if (cond) |
| 30 |
{ |
| 31 |
/* .... */ |
| 32 |
} |
| 33 |
else if (other_cond) |
| 34 |
{ |
| 35 |
odr_types[val->id] = 0; /* { dg-message "in expansion of macro 'odr_types'" } */ |
| 36 |
/* .... */ |
| 37 |
if (odr_types_ptr) /* { dg-warning "check of 'odr_types_ptr' for NULL after already dereferencing it" } */ |
| 38 |
{ |
| 39 |
/* .... */ |
| 40 |
val->id = 42; |
| 41 |
} |
| 42 |
/* .... */ |
| 43 |
} |
| 44 |
return val; |
| 45 |
} |