| 1 |
/* Verify that we can reconstruct fndecl and stack depth information |
| 2 |
after early inlining. */ |
| 3 |
|
| 4 |
/* { dg-additional-options "-O2 -fdiagnostics-show-path-depths" } */ |
| 5 |
|
| 6 |
#include "../../gcc.dg/analyzer/analyzer-decls.h" |
| 7 |
typedef __SIZE_TYPE__ size_t; |
| 8 |
|
| 9 |
|
| 10 |
struct input_file_st |
| 11 |
{ |
| 12 |
char inpname[1]; |
| 13 |
}; |
| 14 |
|
| 15 |
typedef struct input_file_st input_file; |
| 16 |
|
| 17 |
static inline const char* |
| 18 |
get_input_file_name (const input_file *inpf) |
| 19 |
{ |
| 20 |
if (inpf) |
| 21 |
/* { dg-message "following 'false' branch \\(when 'inpf' is NULL\\)\\.\\.\\. \\(fndecl 'get_input_file_name', depth 2\\)" "" { target c } .-1 } */ |
| 22 |
/* { dg-message "following 'false' branch \\(when 'inpf' is NULL\\)\\.\\.\\. \\(fndecl 'const char\\* get_input_file_name\\(const input_file\\*\\)', depth 2\\)" "" { target c++ } .-2 } */ |
| 23 |
return inpf->inpname; |
| 24 |
return NULL; |
| 25 |
} |
| 26 |
|
| 27 |
size_t |
| 28 |
test (const input_file *inpf) |
| 29 |
{ |
| 30 |
const char *f = get_input_file_name (inpf); |
| 31 |
return __builtin_strlen (f); /* { dg-warning "use of NULL" "warning" } */ |
| 32 |
/* { dg-message "NULL where non-null expected \\(fndecl 'test', depth 1\\)" "message" { target c } .-1 } */ |
| 33 |
/* { dg-message "NULL where non-null expected \\(fndecl 'size_t test\\(const input_file\\*\\)', depth 1\\)" "message" { target c++ } .-2 } */ |
| 34 |
} |