Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/inlining-4.c

raw
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
8 static inline const char*
9 inner (int flag)
10 {
11 if (flag)
12 /* { dg-message "following 'true' branch \\(when 'flag != 0'\\)\\.\\.\\. \\(fndecl 'inner', depth 3\\)" "" { target c } .-1 } */
13 /* { dg-message "following 'true' branch \\(when 'flag != 0'\\)\\.\\.\\. \\(fndecl 'const char\\* inner\\(int\\)', depth 3\\)" "" { target c++ } .-2 } */
14 return NULL;
15 return "foo";
16 }
17
18 static inline const char*
19 middle (int flag)
20 {
21 return inner (flag);
22 }
23
24 char
25 outer (int flag)
26 {
27 return *middle (flag); /* { dg-warning "dereference of NULL" "warning" } */
28 /* { dg-message "\\(fndecl 'outer', depth 1\\)" "message" { target c } .-1 } */
29 /* { dg-message "\\(fndecl 'char outer\\(int\\)', depth 1\\)" "message" { target c++ } .-2 } */
30 }