Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4390e4c

Browse filesBrowse files
committed
C++: Fix handling of unreached instructions in IRGuards
1 parent d6e30cd commit 4390e4c
Copy full SHA for 4390e4c

File tree

2 files changed

+3
-1
lines changed
Filter options

2 files changed

+3
-1
lines changed

‎cpp/ql/lib/semmle/code/cpp/controlflow/IRGuards.qll

Copy file name to clipboardExpand all lines: cpp/ql/lib/semmle/code/cpp/controlflow/IRGuards.qll
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ private class GuardConditionFromIR extends GuardCondition {
223223
or
224224
instr = tce.getInstruction(ConditionValueFalseTempAddressTag())
225225
)
226+
or
227+
// Exclude unreached instructions, as their AST is the whole function and not a block.
228+
instr instanceof UnreachedInstruction
226229
}
227230
}
228231

‎cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected

Copy file name to clipboardExpand all lines: cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ astGuardsControl
257257
| test.c:175:13:175:32 | ... == ... | false | 175 | 175 |
258258
| test.c:175:13:175:32 | ... == ... | true | 175 | 175 |
259259
| test.c:181:9:181:9 | x | false | 183 | 184 |
260-
| test.c:181:9:181:9 | x | false | 186 | 180 |
261260
| test.c:181:9:181:9 | x | true | 181 | 182 |
262261
| test.c:181:9:181:9 | x | true | 186 | 180 |
263262
| test.cpp:18:8:18:10 | call to get | true | 19 | 19 |

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.