Skip to content

Commit 57cc316

Browse files
committed
C++: Fix bug for single-instruction basic blocks.
1 parent 771abf4 commit 57cc316

File tree

1 file changed

+3
-2
lines changed
  • cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa

1 file changed

+3
-2
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,9 @@ private module Cached {
271271
/** Holds if `i` is the `index`th instruction in `block`. */
272272
cached
273273
Instruction getInstruction(TIRBlock block, int index) {
274-
exists(Instruction first |
275-
block = MkIRBlock(first) and
274+
exists(Instruction first | block = MkIRBlock(first) |
275+
first = result and index = 0
276+
or
276277
index = getMemberIndex(result) and
277278
BlockAdjacency::getEquivalenceClass(first) = BlockAdjacency::getEquivalenceClass(result)
278279
)

0 commit comments

Comments
 (0)