File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
cpp/ql/test/query-tests/Critical/DeadCodeGoto Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 11| test.cpp:2:2:2:12 | goto ... | This statement makes $@ unreachable. | test.cpp:3:2:3:5 | ExprStmt | ExprStmt |
22| test.cpp:9:3:9:8 | break; | This statement makes $@ unreachable. | test.cpp:10:3:10:6 | ExprStmt | ExprStmt |
33| test.cpp:37:3:37:8 | break; | This statement makes $@ unreachable. | test.cpp:38:3:38:11 | return ... | return ... |
4+ | test.cpp:91:2:91:11 | goto ... | This statement makes $@ unreachable. | test.cpp:93:2:93:5 | ExprStmt | ExprStmt |
Original file line number Diff line number Diff line change @@ -81,3 +81,29 @@ void test7(int x, int cond) {
8181 }
8282 end:
8383}
84+
85+ #define CONFIG_DEFINE
86+
87+ void test8 () {
88+ int x = 0 ;
89+
90+ #ifdef CONFIG_DEFINE
91+ goto skip; // GOOD (the `x++` is still reachable in some configurations) [FALSE POSITIVE]
92+ #endif
93+ x++;
94+
95+ skip:
96+ }
97+
98+ void test9 () {
99+ int x = 0 ;
100+
101+ #ifdef CONFIG_NOTDEFINED
102+ goto mid;
103+ #endif
104+ goto end; // GOOD (the `x++` is still reachable in some configurations)
105+ mid:
106+ x++;
107+
108+ end:
109+ }
You can’t perform that action at this time.
0 commit comments