Skip to content

Commit 675e284

Browse files
committed
C++: A 'LoadInstruction' in a store chain always sets 'certain = false'.
1 parent ee2541c commit 675e284

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/Ssa.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ predicate explicitWrite(boolean certain, Instruction instr, Instruction address)
275275
|
276276
if
277277
addressFlowTC(any(Instruction i |
278-
i instanceof FieldAddressInstruction or i instanceof PointerArithmeticInstruction
278+
i instanceof FieldAddressInstruction or
279+
i instanceof PointerArithmeticInstruction or
280+
i instanceof LoadInstruction
279281
), store.getDestinationAddress())
280282
then certain = false
281283
else certain = true

cpp/ql/test/library-tests/dataflow/dataflow-tests/dataflow-ir-consistency.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ postWithInFlow
181181
| dispatch.cpp:130:10:130:15 | VariableAddress [post update] | PostUpdateNode should not be the target of local flow. |
182182
| dispatch.cpp:130:10:130:15 | topRef [post update] | PostUpdateNode should not be the target of local flow. |
183183
| dispatch.cpp:130:17:130:24 | topRef [post update] | PostUpdateNode should not be the target of local flow. |
184+
| dispatch.cpp:148:3:148:3 | u [post update] | PostUpdateNode should not be the target of local flow. |
184185
| dispatch.cpp:148:5:148:5 | f [post update] | PostUpdateNode should not be the target of local flow. |
186+
| dispatch.cpp:168:3:168:4 | u2 [post update] | PostUpdateNode should not be the target of local flow. |
187+
| dispatch.cpp:168:6:168:6 | u [post update] | PostUpdateNode should not be the target of local flow. |
185188
| dispatch.cpp:168:8:168:8 | f [post update] | PostUpdateNode should not be the target of local flow. |
186189
| example.c:17:19:17:22 | FieldAddress [post update] | PostUpdateNode should not be the target of local flow. |
187190
| example.c:17:19:17:22 | FieldAddress [post update] | PostUpdateNode should not be the target of local flow. |

0 commit comments

Comments
 (0)