From 27a83e65b26bf069c5e5096b2067a84f42c45092 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Thu, 13 Sep 2018 10:47:14 -0700 Subject: [PATCH 01/33] C++: add RelationalOpcode and RelationalInstruction --- .../code/cpp/ir/implementation/Opcode.qll | 10 ++-- .../aliased_ssa/Instruction.qll | 49 +++++++++++++++++-- 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/Opcode.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/Opcode.qll index dd12ea1a8a54..992dde33bcc7 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/Opcode.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/Opcode.qll @@ -76,6 +76,8 @@ abstract class PointerOffsetOpcode extends PointerArithmeticOpcode {} abstract class CompareOpcode extends BinaryOpcode {} +abstract class RelationalOpcode extends CompareOpcode {} + abstract class CopyOpcode extends Opcode {} abstract class MemoryAccessOpcode extends Opcode {} @@ -117,10 +119,10 @@ module Opcode { class LogicalNot extends UnaryOpcode, TLogicalNot { override final string toString() { result = "LogicalNot" } } class CompareEQ extends CompareOpcode, TCompareEQ { override final string toString() { result = "CompareEQ" } } class CompareNE extends CompareOpcode, TCompareNE { override final string toString() { result = "CompareNE" } } - class CompareLT extends CompareOpcode, TCompareLT { override final string toString() { result = "CompareLT" } } - class CompareGT extends CompareOpcode, TCompareGT { override final string toString() { result = "CompareGT" } } - class CompareLE extends CompareOpcode, TCompareLE { override final string toString() { result = "CompareLE" } } - class CompareGE extends CompareOpcode, TCompareGE { override final string toString() { result = "CompareGE" } } + class CompareLT extends RelationalOpcode, TCompareLT { override final string toString() { result = "CompareLT" } } + class CompareGT extends RelationalOpcode, TCompareGT { override final string toString() { result = "CompareGT" } } + class CompareLE extends RelationalOpcode, TCompareLE { override final string toString() { result = "CompareLE" } } + class CompareGE extends RelationalOpcode, TCompareGE { override final string toString() { result = "CompareGE" } } class PointerAdd extends PointerOffsetOpcode, TPointerAdd { override final string toString() { result = "PointerAdd" } } class PointerSub extends PointerOffsetOpcode, TPointerSub { override final string toString() { result = "PointerSub" } } class PointerDiff extends PointerArithmeticOpcode, TPointerDiff { override final string toString() { result = "PointerDiff" } } diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll index e63fd979def7..d70f4f8a36e4 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll @@ -967,28 +967,69 @@ class CompareNEInstruction extends CompareInstruction { } } -class CompareLTInstruction extends CompareInstruction { +class RelationalInstruction extends CompareInstruction { + RelationalInstruction() { + opcode instanceof RelationalOpcode + } + + abstract Instruction getGreaterOperand(); + abstract Instruction getLesserOperand(); +} + +class CompareLTInstruction extends RelationalInstruction { CompareLTInstruction() { opcode instanceof Opcode::CompareLT } + + override Instruction getLesserOperand() { + result = getLeftOperand() + } + + override Instruction getGreaterOperand() { + result = getRightOperand() + } } -class CompareGTInstruction extends CompareInstruction { +class CompareGTInstruction extends RelationalInstruction { CompareGTInstruction() { opcode instanceof Opcode::CompareGT } + + override Instruction getLesserOperand() { + result = getRightOperand() + } + + override Instruction getGreaterOperand() { + result = getLeftOperand() + } } -class CompareLEInstruction extends CompareInstruction { +class CompareLEInstruction extends RelationalInstruction { CompareLEInstruction() { opcode instanceof Opcode::CompareLE } + + override Instruction getLesserOperand() { + result = getLeftOperand() + } + + override Instruction getGreaterOperand() { + result = getRightOperand() + } } -class CompareGEInstruction extends CompareInstruction { +class CompareGEInstruction extends RelationalInstruction { CompareGEInstruction() { opcode instanceof Opcode::CompareGE } + + override Instruction getLesserOperand() { + result = getRightOperand() + } + + override Instruction getGreaterOperand() { + result = getLeftOperand() + } } class SwitchInstruction extends Instruction { From 4e1a37cd6e9b000cb4c246068da314a1c26be1be Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Fri, 14 Sep 2018 10:50:10 -0700 Subject: [PATCH 02/33] C++: add isStrict to RelationalInstruction --- .../implementation/aliased_ssa/Instruction.qll | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll index d70f4f8a36e4..d01378e32cae 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll @@ -974,6 +974,7 @@ class RelationalInstruction extends CompareInstruction { abstract Instruction getGreaterOperand(); abstract Instruction getLesserOperand(); + abstract predicate isStrict(); } class CompareLTInstruction extends RelationalInstruction { @@ -988,6 +989,10 @@ class CompareLTInstruction extends RelationalInstruction { override Instruction getGreaterOperand() { result = getRightOperand() } + + override predicate isStrict() { + any() + } } class CompareGTInstruction extends RelationalInstruction { @@ -1002,6 +1007,10 @@ class CompareGTInstruction extends RelationalInstruction { override Instruction getGreaterOperand() { result = getLeftOperand() } + + override predicate isStrict() { + any() + } } class CompareLEInstruction extends RelationalInstruction { @@ -1016,6 +1025,10 @@ class CompareLEInstruction extends RelationalInstruction { override Instruction getGreaterOperand() { result = getRightOperand() } + + override predicate isStrict() { + none() + } } class CompareGEInstruction extends RelationalInstruction { @@ -1030,6 +1043,10 @@ class CompareGEInstruction extends RelationalInstruction { override Instruction getGreaterOperand() { result = getLeftOperand() } + + override predicate isStrict() { + none() + } } class SwitchInstruction extends Instruction { From d7e630b3c655117507e2e6ae1894a1ed0891900e Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Fri, 14 Sep 2018 10:46:02 -0700 Subject: [PATCH 03/33] C++: Add IR-based port of Guards library For ease of reviewing, I've checked in the .expected files from the AST-based guards library. The next commit accepts output for these tests and adds tests that use getAST rather than the translation layer. --- .../semmle/code/cpp/controlflow/IRGuards.qll | 472 ++++++++++++++++++ .../controlflow/guards-ir/ASTGuards.expected | 32 ++ .../controlflow/guards-ir/ASTGuards.ql | 5 + .../guards-ir/ASTGuardsCompare.expected | 88 ++++ .../controlflow/guards-ir/ASTGuardsCompare.ql | 25 + .../guards-ir/ASTGuardsControl.expected | 90 ++++ .../controlflow/guards-ir/ASTGuardsControl.ql | 17 + .../guards-ir/ASTGuardsEnsure.expected | 160 ++++++ .../controlflow/guards-ir/ASTGuardsEnsure.ql | 23 + .../controlflow/guards-ir/test.c | 149 ++++++ .../controlflow/guards-ir/test.cpp | 54 ++ 11 files changed, 1115 insertions(+) create mode 100644 cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.ql create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.ql create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.ql create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.ql create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/test.c create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/test.cpp diff --git a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll new file mode 100644 index 000000000000..d8e7e1c12742 --- /dev/null +++ b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll @@ -0,0 +1,472 @@ +import cpp +import semmle.code.cpp.ir.IR + +/** + * A Boolean condition in the IR that guards one or more basic blocks. This includes + * operands of logical operators but not switch statements. + */ +class GuardCondition extends Expr { + GuardCondition() { + exists(IRGuardCondition ir | this.getFullyConverted() = ir.getAST()) + or + // no binary operators in the IR + exists(Instruction ir | + this.(BinaryLogicalOperation).getAnOperand().getFullyConverted() = ir.getAST() + ) + or + // the IR short-circuits if(!x) + ( + not exists (Instruction inst | this.getFullyConverted() = inst.getAST()) and + exists(IRGuardCondition ir | this.(NotExpr).getOperand() = ir.getAST()) + ) + } + /** + * Holds if this condition controls `block`, meaning that `block` is only + * entered if the value of this condition is `testIsTrue`. + * + * Illustration: + * + * ``` + * [ (testIsTrue) ] + * [ this ----------------succ ---- controlled ] + * [ | | ] + * [ (testIsFalse) | ------ ... ] + * [ other ] + * ``` + * + * The predicate holds if all paths to `controlled` go via the `testIsTrue` + * edge of the control-flow graph. In other words, the `testIsTrue` edge + * must dominate `controlled`. This means that `controlled` must be + * dominated by both `this` and `succ` (the target of the `testIsTrue` + * edge). It also means that any other edge into `succ` must be a back-edge + * from a node which is dominated by `succ`. + * + * The short-circuit boolean operations have slightly surprising behavior + * here: because the operation itself only dominates one branch (due to + * being short-circuited) then it will only control blocks dominated by the + * true (for `&&`) or false (for `||`) branch. + */ + abstract cached predicate controls(BasicBlock controlled, boolean testIsTrue); + + /** Holds if (determined by this guard) `left < right + k` evaluates to `isLessThan` if this expression evaluates to `testIsTrue`. */ + abstract cached predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue); + + /** Holds if (determined by this guard) `left < right + k` must be `isLessThan` in `block`. + If `isLessThan = false` then this implies `left >= right + k`. */ + abstract cached predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan); + + /** Holds if (determined by this guard) `left == right + k` evaluates to `areEqual` if this expression evaluates to `testIsTrue`. */ + abstract cached predicate comparesEq(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue); + + /** Holds if (determined by this guard) `left == right + k` must be `areEqual` in `block`. + If `areEqual = false` then this implies `left != right + k`. */ + abstract cached predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual); +} + +class GuardConditionFromBinaryLogicalOperator extends GuardCondition { + GuardConditionFromBinaryLogicalOperator() { + exists(GuardCondition gc | + this.(BinaryLogicalOperation).getAnOperand()= gc + ) + } + + override predicate controls(BasicBlock controlled, boolean testIsTrue) { + exists (BinaryLogicalOperation binop, GuardCondition lhs, GuardCondition rhs + | this = binop and + lhs = binop.getLeftOperand() and + rhs = binop.getRightOperand() and + lhs.controls(controlled, testIsTrue) and + rhs.controls(controlled, testIsTrue)) + } + + override predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue) { + exists(boolean partIsTrue, GuardCondition part | + this.(BinaryLogicalOperation).impliesValue(part, partIsTrue, testIsTrue) | + part.comparesLt(left, right, k, isLessThan, partIsTrue) + ) + } + + override predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan) { + exists(boolean testIsTrue | + comparesLt(left, right, k, isLessThan, testIsTrue) and this.controls(block, testIsTrue) + ) + } + + override predicate comparesEq(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue) { + exists(boolean partIsTrue, GuardCondition part | + this.(BinaryLogicalOperation).impliesValue(part, partIsTrue, testIsTrue) | + part.comparesEq(left, right, k, isLessThan, partIsTrue) + ) + } + + override predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan) { + exists(boolean testIsTrue | + comparesEq(left, right, k, isLessThan, testIsTrue) and this.controls(block, testIsTrue) + ) + } +} + +class GuardConditionFromShortCircuitNot extends GuardCondition, NotExpr { + GuardConditionFromShortCircuitNot() { + not exists (Instruction inst | this.getFullyConverted() = inst.getAST()) and + exists(IRGuardCondition ir | getOperand() = ir.getAST()) + } + + override predicate controls(BasicBlock controlled, boolean testIsTrue) { + getOperand().(GuardCondition).controls(controlled, testIsTrue.booleanNot()) + } + + override predicate comparesLt(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue) { + getOperand().(GuardCondition).comparesLt(left, right, k, areEqual, testIsTrue.booleanNot()) + } + + override predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean testIsTrue) { + getOperand().(GuardCondition).ensuresLt(left, right, k, block, testIsTrue.booleanNot()) + } + + override predicate comparesEq(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue) { + getOperand().(GuardCondition).comparesEq(left, right, k, areEqual, testIsTrue.booleanNot()) + } + + override predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean testIsTrue) { + getOperand().(GuardCondition).ensuresEq(left, right, k, block, testIsTrue.booleanNot()) + } +} + +class GuardConditionFromIR extends GuardCondition { + IRGuardCondition ir; + + GuardConditionFromIR() { + this.getFullyConverted() = ir.getAST() + } + override predicate controls(BasicBlock controlled, boolean testIsTrue) { + /* This condition must determine the flow of control; that is, this + * node must be a top-level condition. */ + this.controlsBlock(controlled, testIsTrue) + } + + /** Holds if (determined by this guard) `left < right + k` evaluates to `isLessThan` if this expression evaluates to `testIsTrue`. */ + override predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue) { + exists(Instruction li, Instruction ri | + remove_conversions(li.getAST()) = left and + remove_conversions(ri.getAST()) = right and + ir.comparesLt(li, ri, k, isLessThan, testIsTrue) + ) + } + + /** Holds if (determined by this guard) `left < right + k` must be `isLessThan` in `block`. + If `isLessThan = false` then this implies `left >= right + k`. */ + override predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan) { + exists(Instruction li, Instruction ri, boolean testIsTrue | + remove_conversions(li.getAST()) = left and + remove_conversions(ri.getAST()) = right and + ir.comparesLt(li, ri, k, isLessThan, testIsTrue) and + this.controls(block, testIsTrue) + ) + } + + /** Holds if (determined by this guard) `left == right + k` evaluates to `areEqual` if this expression evaluates to `testIsTrue`. */ + override predicate comparesEq(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue) { + exists(Instruction li, Instruction ri | + remove_conversions(li.getAST()) = left and + remove_conversions(ri.getAST()) = right and + ir.comparesEq(li, ri, k, areEqual, testIsTrue) + ) + } + + /** Holds if (determined by this guard) `left == right + k` must be `areEqual` in `block`. + If `areEqual = false` then this implies `left != right + k`. */ + override predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual) { + exists(Instruction li, Instruction ri, boolean testIsTrue | + remove_conversions(li.getAST()) = left and + remove_conversions(ri.getAST()) = right and + ir.comparesEq(li, ri, k, areEqual, testIsTrue) + and this.controls(block, testIsTrue) + ) + } + + /** + * Holds if this condition controls `block`, meaning that `block` is only + * entered if the value of this condition is `testIsTrue`. This helper + * predicate does not necessarily hold for binary logical operations like + * `&&` and `||`. See the detailed explanation on predicate `controls`. + */ + private predicate controlsBlock(BasicBlock controlled, boolean testIsTrue) { + exists(IRBlock irb | + forex(IRGuardCondition inst | inst = ir | inst.controls(irb, testIsTrue)) and + irb.getAnInstruction().getAST().(ControlFlowNode).getBasicBlock() = controlled + ) + } +} + +/** + * A Boolean condition in the IR that guards one or more basic blocks. This includes + * operands of logical operators but not switch statements. Note that `&&` and `||` + * don't have an explicit representation in the IR, and therefore will not appear as + * IRGuardConditions. + */ +class IRGuardCondition extends Instruction { + + IRGuardCondition() { + is_condition(this) + } + + /** + * Holds if this condition controls `block`, meaning that `block` is only + * entered if the value of this condition is `testIsTrue`. + * + * Illustration: + * + * ``` + * [ (testIsTrue) ] + * [ this ----------------succ ---- controlled ] + * [ | | ] + * [ (testIsFalse) | ------ ... ] + * [ other ] + * ``` + * + * The predicate holds if all paths to `controlled` go via the `testIsTrue` + * edge of the control-flow graph. In other words, the `testIsTrue` edge + * must dominate `controlled`. This means that `controlled` must be + * dominated by both `this` and `succ` (the target of the `testIsTrue` + * edge). It also means that any other edge into `succ` must be a back-edge + * from a node which is dominated by `succ`. + * + * The short-circuit boolean operations have slightly surprising behavior + * here: because the operation itself only dominates one branch (due to + * being short-circuited) then it will only control blocks dominated by the + * true (for `&&`) or false (for `||`) branch. + */ + cached predicate controls(IRBlock controlled, boolean testIsTrue) { + /* This condition must determine the flow of control; that is, this + * node must be a top-level condition. */ + this.controlsBlock(controlled, testIsTrue) + or + exists (IRGuardCondition ne + | this = ne.(LogicalNotInstruction).getOperand() and + ne.controls(controlled, testIsTrue.booleanNot())) + } + + /** Holds if (determined by this guard) `left < right + k` evaluates to `isLessThan` if this expression evaluates to `testIsTrue`. */ + cached predicate comparesLt(Instruction left, Instruction right, int k, boolean isLessThan, boolean testIsTrue) { + compares_lt(this, left, right, k, isLessThan, testIsTrue) + } + + /** Holds if (determined by this guard) `left < right + k` must be `isLessThan` in `block`. + If `isLessThan = false` then this implies `left >= right + k`. */ + cached predicate ensuresLt(Instruction left, Instruction right, int k, IRBlock block, boolean isLessThan) { + exists(boolean testIsTrue | + compares_lt(this, left, right, k, isLessThan, testIsTrue) and this.controls(block, testIsTrue) + ) + } + + /** Holds if (determined by this guard) `left == right + k` evaluates to `areEqual` if this expression evaluates to `testIsTrue`. */ + cached predicate comparesEq(Instruction left, Instruction right, int k, boolean areEqual, boolean testIsTrue) { + compares_eq(this, left, right, k, areEqual, testIsTrue) + } + + /** Holds if (determined by this guard) `left == right + k` must be `areEqual` in `block`. + If `areEqual = false` then this implies `left != right + k`. */ + cached predicate ensuresEq(Instruction left, Instruction right, int k, IRBlock block, boolean areEqual) { + exists(boolean testIsTrue | + compares_eq(this, left, right, k, areEqual, testIsTrue) and this.controls(block, testIsTrue) + ) + } + + /** + * Holds if this condition controls `block`, meaning that `block` is only + * entered if the value of this condition is `testIsTrue`. This helper + * predicate does not necessarily hold for binary logical operations like + * `&&` and `||`. See the detailed explanation on predicate `controls`. + */ + private predicate controlsBlock(IRBlock controlled, boolean testIsTrue) { + exists(IRBlock thisblock + | thisblock.getAnInstruction() = this + | exists(IRBlock succ, ConditionalBranchInstruction branch + | testIsTrue = true and succ.getFirstInstruction() = branch.getTrueSuccessor() + or + testIsTrue = false and succ.getFirstInstruction() = branch.getFalseSuccessor() + | branch.getCondition() = this and + succ.dominates(controlled) and + forall(IRBlock pred + | pred.getASuccessor() = succ + | pred = thisblock or succ.dominates(pred)))) // removed reachability condition - is that OK? + } +} + +private predicate is_condition(Instruction guard) { + exists(ConditionalBranchInstruction branch| + branch.getCondition() = guard + ) + or + exists(LogicalNotInstruction cond | is_condition(cond) and cond.getOperand() = guard) +} + +/** + * Holds if `left == right + k` is `areEqual` given that test is `testIsTrue`. + * + * Beware making mistaken logical implications here relating `areEqual` and `testIsTrue`. + */ +private predicate compares_eq(Instruction test, Instruction left, Instruction right, int k, boolean areEqual, boolean testIsTrue) { + /* The simple case where the test *is* the comparison so areEqual = testIsTrue xor eq. */ + exists(boolean eq | simple_comparison_eq(test, left, right, k, eq) | + areEqual = true and testIsTrue = eq or areEqual = false and testIsTrue = eq.booleanNot() + ) + // I think this is handled by forwarding in controlsBlock. + /* or + logical_comparison_eq(test, left, right, k, areEqual, testIsTrue) */ + or + /* a == b + k => b == a - k */ + exists(int mk | k = -mk | compares_eq(test, right, left, mk, areEqual, testIsTrue)) + or + complex_eq(test, left, right, k, areEqual, testIsTrue) + or + /* (x is true => (left == right + k)) => (!x is false => (left == right + k)) */ + exists(boolean isFalse | testIsTrue = isFalse.booleanNot() | + compares_eq(test.(LogicalNotInstruction).getOperand(), left, right, k, areEqual, isFalse) + ) +} + +/** Rearrange various simple comparisons into `left == right + k` form. */ +private predicate simple_comparison_eq(CompareInstruction cmp, Instruction left, Instruction right, int k, boolean areEqual) { + left = cmp.getLeftOperand() and cmp instanceof CompareEQInstruction and right = cmp.getRightOperand() and k = 0 and areEqual = true + or + left = cmp.getLeftOperand() and cmp instanceof CompareNEInstruction and right = cmp.getRightOperand() and k = 0 and areEqual = false +} + +private predicate complex_eq(CompareInstruction cmp, Instruction left, Instruction right, int k, boolean areEqual, boolean testIsTrue) { + sub_eq(cmp, left, right, k, areEqual, testIsTrue) + or + add_eq(cmp, left, right, k, areEqual, testIsTrue) +} + + +/* Simplification of inequality expressions + * Simplify conditions in the source to the canonical form l < r + k. + */ + +/** Holds if `left < right + k` evaluates to `isLt` given that test is `testIsTrue`. */ +private predicate compares_lt(Instruction test, Instruction left, Instruction right, int k, boolean isLt, boolean testIsTrue) { + /* In the simple case, the test is the comparison, so isLt = testIsTrue */ + simple_comparison_lt(test, left, right, k) and isLt = true and testIsTrue = true + or + simple_comparison_lt(test, left, right, k) and isLt = false and testIsTrue = false + or + complex_lt(test, left, right, k, isLt, testIsTrue) + or + /* (not (left < right + k)) => (left >= right + k) */ + exists(boolean isGe | isLt = isGe.booleanNot() | + compares_ge(test, left, right, k, isGe, testIsTrue) + ) + or + /* (x is true => (left < right + k)) => (!x is false => (left < right + k)) */ + exists(boolean isFalse | testIsTrue = isFalse.booleanNot() | + compares_lt(test.(LogicalNotInstruction).getOperand(), left, right, k, isLt, isFalse) + ) +} + +/** `(a < b + k) => (b > a - k) => (b >= a + (1-k))` */ +private predicate compares_ge(Instruction test, Instruction left, Instruction right, int k, boolean isGe, boolean testIsTrue) { + exists(int onemk | k = 1 - onemk | compares_lt(test, right, left, onemk, isGe, testIsTrue)) +} + +/** Rearrange various simple comparisons into `left < right + k` form. */ +private predicate simple_comparison_lt(CompareInstruction cmp, Instruction left, Instruction right, int k) { + left = cmp.getLeftOperand() and cmp instanceof CompareLTInstruction and right = cmp.getRightOperand() and k = 0 + or + left = cmp.getLeftOperand() and cmp instanceof CompareLEInstruction and right = cmp.getRightOperand() and k = 1 + or + right = cmp.getLeftOperand() and cmp instanceof CompareGTInstruction and left = cmp.getRightOperand() and k = 0 + or + right = cmp.getLeftOperand() and cmp instanceof CompareGEInstruction and left = cmp.getRightOperand() and k = 1 +} + +private predicate complex_lt(CompareInstruction cmp, Instruction left, Instruction right, int k, boolean isLt, boolean testIsTrue) { + sub_lt(cmp, left, right, k, isLt, testIsTrue) + or + add_lt(cmp, left, right, k, isLt, testIsTrue) +} + + +/* left - x < right + c => left < right + (c+x) + left < (right - x) + c => left < right + (c-x) */ +private predicate sub_lt(CompareInstruction cmp, Instruction left, Instruction right, int k, boolean isLt, boolean testIsTrue) { + exists(SubInstruction lhs, int c, int x | compares_lt(cmp, lhs, right, c, isLt, testIsTrue) and + left = lhs.getLeftOperand() and x = int_value(lhs.getRightOperand()) + and k = c + x + ) + or + exists(SubInstruction rhs, int c, int x | compares_lt(cmp, left, rhs, c, isLt, testIsTrue) and + right = rhs.getLeftOperand() and x = int_value(rhs.getRightOperand()) + and k = c - x + ) +} + +/* left + x < right + c => left < right + (c-x) + left < (right + x) + c => left < right + (c+x) */ +private predicate add_lt(CompareInstruction cmp, Instruction left, Instruction right, int k, boolean isLt, boolean testIsTrue) { + exists(AddInstruction lhs, int c, int x | compares_lt(cmp, lhs, right, c, isLt, testIsTrue) and + (left = lhs.getLeftOperand() and x = int_value(lhs.getRightOperand()) + or + left = lhs.getRightOperand() and x = int_value(lhs.getLeftOperand()) + ) + and k = c - x + ) + or + exists(AddInstruction rhs, int c, int x | compares_lt(cmp, left, rhs, c, isLt, testIsTrue) and + (right = rhs.getLeftOperand() and x = int_value(rhs.getRightOperand()) + or + right = rhs.getRightOperand() and x = int_value(rhs.getLeftOperand()) + ) + and k = c + x + ) +} + + +/* left - x == right + c => left == right + (c+x) + left == (right - x) + c => left == right + (c-x) */ +private predicate sub_eq(CompareInstruction cmp, Instruction left, Instruction right, int k, boolean areEqual, boolean testIsTrue) { + exists(SubInstruction lhs, int c, int x | compares_eq(cmp, lhs, right, c, areEqual, testIsTrue) and + left = lhs.getLeftOperand() and x = int_value(lhs.getRightOperand()) + and k = c + x + ) + or + exists(SubInstruction rhs, int c, int x | compares_eq(cmp, left, rhs, c, areEqual, testIsTrue) and + right = rhs.getLeftOperand() and x = int_value(rhs.getRightOperand()) + and k = c - x + ) +} + + +/* left + x == right + c => left == right + (c-x) + left == (right + x) + c => left == right + (c+x) */ +private predicate add_eq(CompareInstruction cmp, Instruction left, Instruction right, int k, boolean areEqual, boolean testIsTrue) { + exists(AddInstruction lhs, int c, int x | compares_eq(cmp, lhs, right, c, areEqual, testIsTrue) and + (left = lhs.getLeftOperand() and x = int_value(lhs.getRightOperand()) + or + left = lhs.getRightOperand() and x = int_value(lhs.getLeftOperand()) + ) + and k = c - x + ) + or + exists(AddInstruction rhs, int c, int x | compares_eq(cmp, left, rhs, c, areEqual, testIsTrue) and + (right = rhs.getLeftOperand() and x = int_value(rhs.getRightOperand()) + or + right = rhs.getRightOperand() and x = int_value(rhs.getLeftOperand()) + ) + and k = c + x + ) +} + +/** The int value of integer constant expression. */ +private int int_value(Instruction i) { + result = i.(IntegerConstantInstruction).getValue().toInt() +} + + +private Expr remove_conversions(Expr e) { + if e instanceof Conversion + then result = e.(Conversion).getExpr*() and + not result instanceof Conversion + else result = e +} diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected new file mode 100644 index 000000000000..b73e7064339e --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected @@ -0,0 +1,32 @@ +| test.c:7:9:7:13 | ... > ... | +| test.c:17:8:17:12 | ... < ... | +| test.c:17:8:17:21 | ... && ... | +| test.c:17:17:17:21 | ... > ... | +| test.c:26:11:26:15 | ... > ... | +| test.c:34:16:34:21 | ... < ... | +| test.c:42:16:42:21 | ... < ... | +| test.c:44:12:44:16 | ... > ... | +| test.c:45:16:45:20 | ... > ... | +| test.c:58:9:58:14 | ... == ... | +| test.c:58:9:58:23 | ... \|\| ... | +| test.c:58:19:58:23 | ... < ... | +| test.c:75:9:75:14 | ... == ... | +| test.c:85:8:85:13 | ... == ... | +| test.c:85:8:85:23 | ... && ... | +| test.c:85:18:85:23 | ... != ... | +| test.c:94:11:94:16 | ... != ... | +| test.c:102:16:102:21 | ... < ... | +| test.c:109:9:109:14 | ... == ... | +| test.c:109:9:109:23 | ... \|\| ... | +| test.c:109:19:109:23 | ... < ... | +| test.c:126:7:126:7 | 1 | +| test.c:126:7:126:28 | ... && ... | +| test.c:126:12:126:26 | call to test3_condition | +| test.c:131:7:131:7 | b | +| test.c:137:7:137:7 | 0 | +| test.c:138:9:138:9 | i | +| test.c:146:7:146:8 | ! ... | +| test.c:146:8:146:8 | x | +| test.cpp:18:8:18:10 | call to get | +| test.cpp:31:7:31:13 | ... == ... | +| test.cpp:42:13:42:20 | call to getABool | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.ql new file mode 100644 index 000000000000..3c8e19bee412 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.ql @@ -0,0 +1,5 @@ +import cpp +import semmle.code.cpp.controlflow.IRGuards + +from GuardCondition guard +select guard \ No newline at end of file diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected new file mode 100644 index 000000000000..58068f3991df --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected @@ -0,0 +1,88 @@ +| 7 | 0 < x+0 when ... > ... is true | +| 7 | 0 >= x+0 when ... > ... is false | +| 7 | x < 0+1 when ... > ... is false | +| 7 | x >= 0+1 when ... > ... is true | +| 17 | 0 < x+1 when ... < ... is false | +| 17 | 0 >= x+1 when ... && ... is true | +| 17 | 0 >= x+1 when ... < ... is true | +| 17 | 1 < y+0 when ... && ... is true | +| 17 | 1 < y+0 when ... > ... is true | +| 17 | 1 >= y+0 when ... > ... is false | +| 17 | x < 0+0 when ... && ... is true | +| 17 | x < 0+0 when ... < ... is true | +| 17 | x >= 0+0 when ... < ... is false | +| 17 | y < 1+1 when ... > ... is false | +| 17 | y >= 1+1 when ... && ... is true | +| 17 | y >= 1+1 when ... > ... is true | +| 26 | 0 < x+0 when ... > ... is true | +| 26 | 0 >= x+0 when ... > ... is false | +| 26 | x < 0+1 when ... > ... is false | +| 26 | x >= 0+1 when ... > ... is true | +| 31 | - ... != x+0 when ... == ... is false | +| 31 | - ... == x+0 when ... == ... is true | +| 31 | x != - ...+0 when ... == ... is false | +| 31 | x == - ...+0 when ... == ... is true | +| 34 | 10 < j+1 when ... < ... is false | +| 34 | 10 >= j+1 when ... < ... is true | +| 34 | j < 10+0 when ... < ... is true | +| 34 | j >= 10+0 when ... < ... is false | +| 42 | 10 < j+1 when ... < ... is false | +| 42 | 10 >= j+1 when ... < ... is true | +| 42 | j < 10+0 when ... < ... is true | +| 42 | j >= 10+0 when ... < ... is false | +| 44 | 0 < z+0 when ... > ... is true | +| 44 | 0 >= z+0 when ... > ... is false | +| 44 | z < 0+1 when ... > ... is false | +| 44 | z >= 0+1 when ... > ... is true | +| 45 | 0 < y+0 when ... > ... is true | +| 45 | 0 >= y+0 when ... > ... is false | +| 45 | y < 0+1 when ... > ... is false | +| 45 | y >= 0+1 when ... > ... is true | +| 58 | 0 != x+0 when ... == ... is false | +| 58 | 0 != x+0 when ... \|\| ... is false | +| 58 | 0 < y+1 when ... < ... is false | +| 58 | 0 < y+1 when ... \|\| ... is false | +| 58 | 0 == x+0 when ... == ... is true | +| 58 | 0 >= y+1 when ... < ... is true | +| 58 | x != 0+0 when ... == ... is false | +| 58 | x != 0+0 when ... \|\| ... is false | +| 58 | x == 0+0 when ... == ... is true | +| 58 | y < 0+0 when ... < ... is true | +| 58 | y >= 0+0 when ... < ... is false | +| 58 | y >= 0+0 when ... \|\| ... is false | +| 75 | 0 != x+0 when ... == ... is false | +| 75 | 0 == x+0 when ... == ... is true | +| 75 | x != 0+0 when ... == ... is false | +| 75 | x == 0+0 when ... == ... is true | +| 85 | 0 != x+0 when ... == ... is false | +| 85 | 0 != y+0 when ... != ... is true | +| 85 | 0 != y+0 when ... && ... is true | +| 85 | 0 == x+0 when ... && ... is true | +| 85 | 0 == x+0 when ... == ... is true | +| 85 | 0 == y+0 when ... != ... is false | +| 85 | x != 0+0 when ... == ... is false | +| 85 | x == 0+0 when ... && ... is true | +| 85 | x == 0+0 when ... == ... is true | +| 85 | y != 0+0 when ... != ... is true | +| 85 | y != 0+0 when ... && ... is true | +| 85 | y == 0+0 when ... != ... is false | +| 94 | 0 != x+0 when ... != ... is true | +| 94 | 0 == x+0 when ... != ... is false | +| 94 | x != 0+0 when ... != ... is true | +| 94 | x == 0+0 when ... != ... is false | +| 102 | 10 < j+1 when ... < ... is false | +| 102 | 10 >= j+1 when ... < ... is true | +| 102 | j < 10+0 when ... < ... is true | +| 102 | j >= 10+0 when ... < ... is false | +| 109 | 0 != x+0 when ... == ... is false | +| 109 | 0 != x+0 when ... \|\| ... is false | +| 109 | 0 < y+1 when ... < ... is false | +| 109 | 0 < y+1 when ... \|\| ... is false | +| 109 | 0 == x+0 when ... == ... is true | +| 109 | 0 >= y+1 when ... < ... is true | +| 109 | x != 0+0 when ... == ... is false | +| 109 | x != 0+0 when ... \|\| ... is false | +| 109 | x == 0+0 when ... == ... is true | +| 109 | y < 0+0 when ... < ... is true | +| 109 | y >= 0+0 when ... < ... is false | +| 109 | y >= 0+0 when ... \|\| ... is false | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.ql new file mode 100644 index 000000000000..e51e5df741a6 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.ql @@ -0,0 +1,25 @@ +/** + * @name Guards comparison test + * @description List comparison parts. + * @kind test + */ + +import cpp +import semmle.code.cpp.controlflow.IRGuards + + +from GuardCondition guard, Expr left, Expr right, int k, string which, string op, string msg +where +(exists(boolean sense | sense = true and which = "true" or sense = false and which = "false" | + guard.comparesLt(left, right, k, true, sense) and op = " < " + or + guard.comparesLt(left, right, k, false, sense) and op = " >= " + or + guard.comparesEq(left, right, k, true, sense) and op = " == " + or + guard.comparesEq(left, right, k, false, sense) and op = " != " + ) +) +and msg = left + op + right + "+" + k + " when " + guard + " is " + which + +select guard.getLocation().getStartLine(), msg \ No newline at end of file diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected new file mode 100644 index 000000000000..a9f1c7aa6c41 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected @@ -0,0 +1,90 @@ +| test.c:7:9:7:13 | ... > ... | false | 10 | 11 | +| test.c:7:9:7:13 | ... > ... | true | 7 | 9 | +| test.c:17:8:17:12 | ... < ... | true | 17 | 17 | +| test.c:17:8:17:12 | ... < ... | true | 18 | 18 | +| test.c:17:8:17:21 | ... && ... | true | 18 | 18 | +| test.c:17:17:17:21 | ... > ... | true | 18 | 18 | +| test.c:26:11:26:15 | ... > ... | false | 2 | 2 | +| test.c:26:11:26:15 | ... > ... | false | 31 | 34 | +| test.c:26:11:26:15 | ... > ... | false | 34 | 34 | +| test.c:26:11:26:15 | ... > ... | false | 39 | 42 | +| test.c:26:11:26:15 | ... > ... | false | 42 | 42 | +| test.c:26:11:26:15 | ... > ... | false | 42 | 44 | +| test.c:26:11:26:15 | ... > ... | false | 45 | 45 | +| test.c:26:11:26:15 | ... > ... | false | 45 | 47 | +| test.c:26:11:26:15 | ... > ... | false | 48 | 55 | +| test.c:26:11:26:15 | ... > ... | false | 51 | 53 | +| test.c:26:11:26:15 | ... > ... | false | 56 | 58 | +| test.c:26:11:26:15 | ... > ... | false | 58 | 58 | +| test.c:26:11:26:15 | ... > ... | false | 58 | 66 | +| test.c:26:11:26:15 | ... > ... | false | 62 | 62 | +| test.c:26:11:26:15 | ... > ... | true | 26 | 28 | +| test.c:34:16:34:21 | ... < ... | false | 2 | 2 | +| test.c:34:16:34:21 | ... < ... | false | 39 | 42 | +| test.c:34:16:34:21 | ... < ... | false | 42 | 42 | +| test.c:34:16:34:21 | ... < ... | false | 42 | 44 | +| test.c:34:16:34:21 | ... < ... | false | 45 | 45 | +| test.c:34:16:34:21 | ... < ... | false | 45 | 47 | +| test.c:34:16:34:21 | ... < ... | false | 48 | 55 | +| test.c:34:16:34:21 | ... < ... | false | 51 | 53 | +| test.c:34:16:34:21 | ... < ... | false | 56 | 58 | +| test.c:34:16:34:21 | ... < ... | false | 58 | 58 | +| test.c:34:16:34:21 | ... < ... | false | 58 | 66 | +| test.c:34:16:34:21 | ... < ... | false | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | true | 34 | 34 | +| test.c:42:16:42:21 | ... < ... | true | 42 | 42 | +| test.c:42:16:42:21 | ... < ... | true | 42 | 44 | +| test.c:42:16:42:21 | ... < ... | true | 45 | 45 | +| test.c:42:16:42:21 | ... < ... | true | 45 | 47 | +| test.c:42:16:42:21 | ... < ... | true | 48 | 55 | +| test.c:42:16:42:21 | ... < ... | true | 51 | 53 | +| test.c:44:12:44:16 | ... > ... | false | 51 | 53 | +| test.c:44:12:44:16 | ... > ... | true | 45 | 45 | +| test.c:44:12:44:16 | ... > ... | true | 45 | 47 | +| test.c:44:12:44:16 | ... > ... | true | 48 | 55 | +| test.c:45:16:45:20 | ... > ... | false | 48 | 55 | +| test.c:45:16:45:20 | ... > ... | true | 45 | 47 | +| test.c:58:9:58:14 | ... == ... | false | 58 | 58 | +| test.c:58:9:58:14 | ... == ... | false | 62 | 62 | +| test.c:58:9:58:23 | ... \|\| ... | false | 62 | 62 | +| test.c:58:19:58:23 | ... < ... | false | 62 | 62 | +| test.c:75:9:75:14 | ... == ... | false | 78 | 79 | +| test.c:75:9:75:14 | ... == ... | true | 75 | 77 | +| test.c:85:8:85:13 | ... == ... | true | 85 | 85 | +| test.c:85:8:85:13 | ... == ... | true | 86 | 86 | +| test.c:85:8:85:23 | ... && ... | true | 86 | 86 | +| test.c:85:18:85:23 | ... != ... | true | 86 | 86 | +| test.c:94:11:94:16 | ... != ... | false | 70 | 70 | +| test.c:94:11:94:16 | ... != ... | false | 99 | 102 | +| test.c:94:11:94:16 | ... != ... | false | 102 | 102 | +| test.c:94:11:94:16 | ... != ... | false | 107 | 109 | +| test.c:94:11:94:16 | ... != ... | false | 109 | 109 | +| test.c:94:11:94:16 | ... != ... | false | 109 | 117 | +| test.c:94:11:94:16 | ... != ... | false | 113 | 113 | +| test.c:94:11:94:16 | ... != ... | true | 94 | 96 | +| test.c:102:16:102:21 | ... < ... | false | 70 | 70 | +| test.c:102:16:102:21 | ... < ... | false | 107 | 109 | +| test.c:102:16:102:21 | ... < ... | false | 109 | 109 | +| test.c:102:16:102:21 | ... < ... | false | 109 | 117 | +| test.c:102:16:102:21 | ... < ... | false | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | true | 102 | 102 | +| test.c:109:9:109:14 | ... == ... | false | 109 | 109 | +| test.c:109:9:109:14 | ... == ... | false | 113 | 113 | +| test.c:109:9:109:23 | ... \|\| ... | false | 113 | 113 | +| test.c:109:19:109:23 | ... < ... | false | 113 | 113 | +| test.c:126:7:126:7 | 1 | true | 126 | 126 | +| test.c:126:7:126:7 | 1 | true | 126 | 128 | +| test.c:126:7:126:7 | 1 | true | 131 | 131 | +| test.c:126:7:126:7 | 1 | true | 131 | 132 | +| test.c:126:7:126:7 | 1 | true | 134 | 123 | +| test.c:126:7:126:28 | ... && ... | true | 126 | 128 | +| test.c:126:12:126:26 | call to test3_condition | true | 126 | 128 | +| test.c:131:7:131:7 | b | true | 131 | 132 | +| test.c:137:7:137:7 | 0 | false | 142 | 136 | +| test.c:138:9:138:9 | i | true | 138 | 139 | +| test.c:146:7:146:8 | ! ... | true | 146 | 147 | +| test.c:146:8:146:8 | x | false | 146 | 147 | +| test.cpp:18:8:18:10 | call to get | false | 20 | 16 | +| test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | true | 31 | 32 | +| test.cpp:42:13:42:20 | call to getABool | true | 43 | 45 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.ql new file mode 100644 index 000000000000..63456cc1f572 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.ql @@ -0,0 +1,17 @@ +/** + * @name Guards control test + * @description List which guards control which blocks + * @kind test + */ + +import cpp +import semmle.code.cpp.controlflow.IRGuards + + +from GuardCondition guard, boolean sense, int start, int end +where +exists(BasicBlock block | + guard.controls(block, sense) and + block.hasLocationInfo(_, start, _, end, _) +) +select guard, sense, start, end diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected new file mode 100644 index 000000000000..99a1097618d8 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected @@ -0,0 +1,160 @@ +| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | < | test.c:7:13:7:13 | 0 | 1 | 10 | 11 | +| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | >= | test.c:7:13:7:13 | 0 | 1 | 7 | 9 | +| test.c:7:9:7:13 | ... > ... | test.c:7:13:7:13 | 0 | < | test.c:7:9:7:9 | x | 0 | 7 | 9 | +| test.c:7:9:7:13 | ... > ... | test.c:7:13:7:13 | 0 | >= | test.c:7:9:7:9 | x | 0 | 10 | 11 | +| test.c:17:8:17:12 | ... < ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 17 | 17 | +| test.c:17:8:17:12 | ... < ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 18 | 18 | +| test.c:17:8:17:12 | ... < ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 17 | 17 | +| test.c:17:8:17:12 | ... < ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 18 | 18 | +| test.c:17:8:17:21 | ... && ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 18 | 18 | +| test.c:17:8:17:21 | ... && ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 18 | 18 | +| test.c:17:8:17:21 | ... && ... | test.c:17:17:17:17 | y | >= | test.c:17:21:17:21 | 1 | 1 | 18 | 18 | +| test.c:17:8:17:21 | ... && ... | test.c:17:21:17:21 | 1 | < | test.c:17:17:17:17 | y | 0 | 18 | 18 | +| test.c:17:17:17:21 | ... > ... | test.c:17:17:17:17 | y | >= | test.c:17:21:17:21 | 1 | 1 | 18 | 18 | +| test.c:17:17:17:21 | ... > ... | test.c:17:21:17:21 | 1 | < | test.c:17:17:17:17 | y | 0 | 18 | 18 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 2 | 2 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 31 | 34 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 34 | 34 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 39 | 42 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 42 | 42 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 42 | 44 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 45 | 45 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 45 | 47 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 48 | 55 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 51 | 53 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 56 | 58 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 58 | 58 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 58 | 66 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 62 | 62 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | >= | test.c:26:15:26:15 | 0 | 1 | 26 | 28 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | < | test.c:26:11:26:11 | x | 0 | 26 | 28 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 2 | 2 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 31 | 34 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 34 | 34 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 39 | 42 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 42 | 42 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 42 | 44 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 45 | 45 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 45 | 47 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 48 | 55 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 51 | 53 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 56 | 58 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 58 | 58 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 58 | 66 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | < | test.c:34:20:34:21 | 10 | 0 | 34 | 34 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 2 | 2 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 39 | 42 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 42 | 42 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 42 | 44 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 45 | 45 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 45 | 47 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 48 | 55 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 51 | 53 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 56 | 58 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 58 | 58 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 58 | 66 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 2 | 2 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 39 | 42 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 42 | 42 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 42 | 44 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 45 | 45 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 45 | 47 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 48 | 55 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 51 | 53 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 56 | 58 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 58 | 58 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 58 | 66 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | >= | test.c:34:16:34:16 | j | 1 | 34 | 34 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 42 | 42 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 42 | 44 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 45 | 45 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 45 | 47 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 48 | 55 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 51 | 53 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 42 | 42 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 42 | 44 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 45 | 45 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 45 | 47 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 48 | 55 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 51 | 53 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | < | test.c:44:16:44:16 | 0 | 1 | 51 | 53 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 45 | 45 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 45 | 47 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 48 | 55 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 45 | 45 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 45 | 47 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 48 | 55 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | >= | test.c:44:12:44:12 | z | 0 | 51 | 53 | +| test.c:45:16:45:20 | ... > ... | test.c:45:16:45:16 | y | < | test.c:45:20:45:20 | 0 | 1 | 48 | 55 | +| test.c:45:16:45:20 | ... > ... | test.c:45:16:45:16 | y | >= | test.c:45:20:45:20 | 0 | 1 | 45 | 47 | +| test.c:45:16:45:20 | ... > ... | test.c:45:20:45:20 | 0 | < | test.c:45:16:45:16 | y | 0 | 45 | 47 | +| test.c:45:16:45:20 | ... > ... | test.c:45:20:45:20 | 0 | >= | test.c:45:16:45:16 | y | 0 | 48 | 55 | +| test.c:58:9:58:14 | ... == ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 58 | 58 | +| test.c:58:9:58:14 | ... == ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 62 | 62 | +| test.c:58:9:58:14 | ... == ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 58 | 58 | +| test.c:58:9:58:14 | ... == ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 62 | 62 | +| test.c:58:9:58:23 | ... \|\| ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 62 | 62 | +| test.c:58:9:58:23 | ... \|\| ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 62 | 62 | +| test.c:58:9:58:23 | ... \|\| ... | test.c:58:19:58:19 | y | >= | test.c:58:23:58:23 | 0 | 0 | 62 | 62 | +| test.c:58:9:58:23 | ... \|\| ... | test.c:58:23:58:23 | 0 | < | test.c:58:19:58:19 | y | 1 | 62 | 62 | +| test.c:58:19:58:23 | ... < ... | test.c:58:19:58:19 | y | >= | test.c:58:23:58:23 | 0 | 0 | 62 | 62 | +| test.c:58:19:58:23 | ... < ... | test.c:58:23:58:23 | 0 | < | test.c:58:19:58:19 | y | 1 | 62 | 62 | +| test.c:75:9:75:14 | ... == ... | test.c:75:9:75:9 | x | != | test.c:75:14:75:14 | 0 | 0 | 78 | 79 | +| test.c:75:9:75:14 | ... == ... | test.c:75:9:75:9 | x | == | test.c:75:14:75:14 | 0 | 0 | 75 | 77 | +| test.c:75:9:75:14 | ... == ... | test.c:75:14:75:14 | 0 | != | test.c:75:9:75:9 | x | 0 | 78 | 79 | +| test.c:75:9:75:14 | ... == ... | test.c:75:14:75:14 | 0 | == | test.c:75:9:75:9 | x | 0 | 75 | 77 | +| test.c:85:8:85:13 | ... == ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 85 | 85 | +| test.c:85:8:85:13 | ... == ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 86 | 86 | +| test.c:85:8:85:13 | ... == ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 85 | 85 | +| test.c:85:8:85:13 | ... == ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 86 | 86 | +| test.c:85:8:85:23 | ... && ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 86 | 86 | +| test.c:85:8:85:23 | ... && ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 86 | 86 | +| test.c:85:8:85:23 | ... && ... | test.c:85:18:85:18 | y | != | test.c:85:23:85:23 | 0 | 0 | 86 | 86 | +| test.c:85:8:85:23 | ... && ... | test.c:85:23:85:23 | 0 | != | test.c:85:18:85:18 | y | 0 | 86 | 86 | +| test.c:85:18:85:23 | ... != ... | test.c:85:18:85:18 | y | != | test.c:85:23:85:23 | 0 | 0 | 86 | 86 | +| test.c:85:18:85:23 | ... != ... | test.c:85:23:85:23 | 0 | != | test.c:85:18:85:18 | y | 0 | 86 | 86 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | != | test.c:94:16:94:16 | 0 | 0 | 94 | 96 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 70 | 70 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 99 | 102 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 102 | 102 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 107 | 109 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 109 | 109 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 109 | 117 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 113 | 113 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | != | test.c:94:11:94:11 | x | 0 | 94 | 96 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 70 | 70 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 99 | 102 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 102 | 102 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 107 | 109 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 109 | 109 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 109 | 117 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | < | test.c:102:20:102:21 | 10 | 0 | 102 | 102 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 70 | 70 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 107 | 109 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 109 | 109 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 109 | 117 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 70 | 70 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 107 | 109 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 109 | 109 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 109 | 117 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | >= | test.c:102:16:102:16 | j | 1 | 102 | 102 | +| test.c:109:9:109:14 | ... == ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 109 | 109 | +| test.c:109:9:109:14 | ... == ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 113 | 113 | +| test.c:109:9:109:14 | ... == ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 109 | 109 | +| test.c:109:9:109:14 | ... == ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 113 | 113 | +| test.c:109:9:109:23 | ... \|\| ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 113 | 113 | +| test.c:109:9:109:23 | ... \|\| ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 113 | 113 | +| test.c:109:9:109:23 | ... \|\| ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | 0 | 0 | 113 | 113 | +| test.c:109:9:109:23 | ... \|\| ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | +| test.c:109:19:109:23 | ... < ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | 0 | 0 | 113 | 113 | +| test.c:109:19:109:23 | ... < ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 31 | 32 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | != | test.cpp:31:7:31:7 | x | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 31 | 32 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.ql new file mode 100644 index 000000000000..85e5f8376f0e --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.ql @@ -0,0 +1,23 @@ +/** + * @name Guards control test + * @description List which guards ensure which inequalities apply to which blocks + * @kind test + */ + +import cpp +import semmle.code.cpp.controlflow.IRGuards + + +from GuardCondition guard, Expr left, Expr right, int k, int start, int end, string op +where +exists(BasicBlock block | + guard.ensuresLt(left, right, k, block, true) and op = "<" + or + guard.ensuresLt(left, right, k, block, false) and op = ">=" + or + guard.ensuresEq(left, right, k, block, true) and op = "==" + or + guard.ensuresEq(left, right, k, block, false) and op = "!=" | + block.hasLocationInfo(_, start, _, end, _) +) +select guard, left, op, right, k, start, end diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/test.c b/cpp/ql/test/library-tests/controlflow/guards-ir/test.c new file mode 100644 index 000000000000..186244d4fca2 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/test.c @@ -0,0 +1,149 @@ + +int test(int x, int w, int z) { + int j; + long y = 50; + + // simple comparison + if (x > 0) { + y = 20; + z = 10; + } else { + y = 30; + } + + z = x + y; + + // More complex + if(x < 0 && y > 1) + y = 40; + else + y = 20; /* The && expression does not control this block as the x<0 expression jumps here if false. */ + + + z = 10; + + // while loop + while(x > 0) { + y = 10; + x--; + } + + z += y; + + // for loop + for(j = 0; j < 10; j++) { + y = 0; + w = 10; + } + + z += w; + + // nested control flow + for(j = 0; j < 10; j++) { + y = 30; + if(z > 0) + if(y > 0) { + w = 0; + break; + } else { + w = 20; + } + else { + w = 10; + continue; + } + x = 0; + } + + if (x == 0 || y < 0) { + y = 60; + z = 10; + } else + return z; + + z += x; + + return 0; +} + + +int test2(int x, int w, int z) { + int j; + long y = 50; + + // simple comparison + if (x == 0) { + y = 20; + z = 10; + } else { + y = 30; + } + + z = x + y; + + // More complex + if(x == 0 && y != 0) + y = 40; + else + y = 20; + + + z = 10; + + // while loop + while(x != 0) { + y = 10; + x--; + } + + z += y; + + // for loop + for(j = 0; j < 10; j++) { + y = 0; + w = 10; + } + + z += w; + + if (x == 0 || y < 0) { + y = 60; + z = 10; + } else + return z; + + z += x; + + return 0; +} + +int test3_condition(); +void test3_action(); + +void test3() { + int b = 0; + + if (1 && test3_condition()) { + b = 1; + test3_action(); + } + + if (b) { + test3_action(); + } +} + +void test4(int i) { + if (0) { + if (i) { + ; + } + } + return; +} + +void test5(int x) { + if (!x) { + test3(); + } +} diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/test.cpp b/cpp/ql/test/library-tests/controlflow/guards-ir/test.cpp new file mode 100644 index 000000000000..46d894813f9b --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/test.cpp @@ -0,0 +1,54 @@ +class X +{ +public: + void set(); +}; + +class Y +{ +public: + Y* f(); + + const X* get() const { return 0; } + X* get() { return 0; } +}; + +Y* Y::f() +{ + if ( get() ) + get()->set(); + return 0; +} + +class Error { +public: + Error() {} +}; + +bool getABool(); + +void doSomething(int x) { + if (x == -1) { + throw new Error(); + } +} + +void doSomethingElse(int x); + +bool testWithCatch0(int v) +{ + try + { + if( getABool() ) + { + doSomething(v); + return true; + } + } + catch(Error &e) + { + doSomethingElse(v); + } + + return false; +} From ad8f30d2f72c65c50a52ee9a18bc9d59b64b53bb Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Fri, 14 Sep 2018 11:01:28 -0700 Subject: [PATCH 04/33] C++: accept test output and add IR guards tests --- .../controlflow/guards-ir/ASTGuards.expected | 1 + .../guards-ir/ASTGuardsCompare.expected | 4 + .../guards-ir/ASTGuardsControl.expected | 11 +- .../guards-ir/ASTGuardsEnsure.expected | 6 + .../controlflow/guards-ir/IRGuards.expected | 26 +++ .../controlflow/guards-ir/IRGuards.ql | 5 + .../guards-ir/IRGuardsCompare.expected | 104 ++++++++++++ .../controlflow/guards-ir/IRGuardsCompare.ql | 30 ++++ .../guards-ir/IRGuardsControl.expected | 85 ++++++++++ .../controlflow/guards-ir/IRGuardsControl.ql | 16 ++ .../guards-ir/IRGuardsEnsure.expected | 152 ++++++++++++++++++ .../controlflow/guards-ir/IRGuardsEnsure.ql | 23 +++ 12 files changed, 458 insertions(+), 5 deletions(-) create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.ql create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.expected create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.ql create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.ql create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.expected create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.ql diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected index b73e7064339e..b73e94106192 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected @@ -28,5 +28,6 @@ | test.c:146:7:146:8 | ! ... | | test.c:146:8:146:8 | x | | test.cpp:18:8:18:10 | call to get | +| test.cpp:18:8:18:12 | (bool)... | | test.cpp:31:7:31:13 | ... == ... | | test.cpp:42:13:42:20 | call to getABool | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected index 58068f3991df..99339f723a61 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected @@ -14,6 +14,10 @@ | 17 | y < 1+1 when ... > ... is false | | 17 | y >= 1+1 when ... && ... is true | | 17 | y >= 1+1 when ... > ... is true | +| 18 | call to get != call to get+0 when (bool)... is true | +| 18 | call to get != call to get+0 when call to get is true | +| 18 | call to get == call to get+0 when (bool)... is false | +| 18 | call to get == call to get+0 when call to get is false | | 26 | 0 < x+0 when ... > ... is true | | 26 | 0 >= x+0 when ... > ... is false | | 26 | x < 0+1 when ... > ... is false | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected index a9f1c7aa6c41..f5fd0f184e48 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected @@ -74,17 +74,18 @@ | test.c:109:19:109:23 | ... < ... | false | 113 | 113 | | test.c:126:7:126:7 | 1 | true | 126 | 126 | | test.c:126:7:126:7 | 1 | true | 126 | 128 | -| test.c:126:7:126:7 | 1 | true | 131 | 131 | -| test.c:126:7:126:7 | 1 | true | 131 | 132 | -| test.c:126:7:126:7 | 1 | true | 134 | 123 | | test.c:126:7:126:28 | ... && ... | true | 126 | 128 | | test.c:126:12:126:26 | call to test3_condition | true | 126 | 128 | | test.c:131:7:131:7 | b | true | 131 | 132 | -| test.c:137:7:137:7 | 0 | false | 142 | 136 | +| test.c:137:7:137:7 | 0 | true | 137 | 138 | +| test.c:137:7:137:7 | 0 | true | 138 | 139 | | test.c:138:9:138:9 | i | true | 138 | 139 | | test.c:146:7:146:8 | ! ... | true | 146 | 147 | | test.c:146:8:146:8 | x | false | 146 | 147 | -| test.cpp:18:8:18:10 | call to get | false | 20 | 16 | +| test.cpp:18:8:18:10 | call to get | true | 19 | 19 | +| test.cpp:18:8:18:12 | (bool)... | true | 19 | 19 | +| test.cpp:31:7:31:13 | ... == ... | false | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | true | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | true | 31 | 32 | | test.cpp:42:13:42:20 | call to getABool | true | 43 | 45 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected index 99a1097618d8..9186ab1fa1ea 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected @@ -154,7 +154,13 @@ | test.c:109:9:109:23 | ... \|\| ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | | test.c:109:19:109:23 | ... < ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | 0 | 0 | 113 | 113 | | test.c:109:19:109:23 | ... < ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | +| test.cpp:18:8:18:10 | call to get | test.cpp:18:8:18:10 | call to get | != | test.cpp:18:8:18:10 | call to get | 0 | 19 | 19 | +| test.cpp:18:8:18:12 | (bool)... | test.cpp:18:8:18:10 | call to get | != | test.cpp:18:8:18:10 | call to get | 0 | 19 | 19 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 31 | 32 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | != | test.cpp:31:7:31:7 | x | 0 | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | != | test.cpp:31:7:31:7 | x | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 31 | 32 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected new file mode 100644 index 000000000000..72892f0e0336 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected @@ -0,0 +1,26 @@ +| test.c:7:9:7:13 | ... > ... | +| test.c:17:8:17:12 | ... < ... | +| test.c:17:17:17:21 | ... > ... | +| test.c:26:11:26:15 | ... > ... | +| test.c:34:16:34:21 | ... < ... | +| test.c:42:16:42:21 | ... < ... | +| test.c:44:12:44:16 | ... > ... | +| test.c:45:16:45:20 | ... > ... | +| test.c:58:9:58:14 | ... == ... | +| test.c:58:19:58:23 | ... < ... | +| test.c:75:9:75:14 | ... == ... | +| test.c:85:8:85:13 | ... == ... | +| test.c:85:18:85:23 | ... != ... | +| test.c:94:11:94:16 | ... != ... | +| test.c:102:16:102:21 | ... < ... | +| test.c:109:9:109:14 | ... == ... | +| test.c:109:19:109:23 | ... < ... | +| test.c:126:7:126:7 | 1 | +| test.c:126:12:126:26 | call to test3_condition | +| test.c:131:7:131:7 | b | +| test.c:137:7:137:7 | 0 | +| test.c:138:9:138:9 | i | +| test.c:146:8:146:8 | x | +| test.cpp:18:8:18:12 | (bool)... | +| test.cpp:31:7:31:13 | ... == ... | +| test.cpp:42:13:42:20 | call to getABool | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.ql new file mode 100644 index 000000000000..9560c9dc79ca --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.ql @@ -0,0 +1,5 @@ +import cpp +import semmle.code.cpp.controlflow.IRGuards + +from IRGuardCondition guard +select guard.getAST() \ No newline at end of file diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.expected new file mode 100644 index 000000000000..d118b0463076 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.expected @@ -0,0 +1,104 @@ +| 7 | 0 < x+0 when ... > ... is true | +| 7 | 0 >= x+0 when ... > ... is false | +| 7 | x < 0+1 when ... > ... is false | +| 7 | x >= 0+1 when ... > ... is true | +| 17 | 0 < x+1 when ... < ... is false | +| 17 | 0 >= x+1 when ... < ... is true | +| 17 | 1 < y+0 when ... > ... is true | +| 17 | 1 >= y+0 when ... > ... is false | +| 17 | (long)... < y+0 when ... > ... is true | +| 17 | (long)... >= y+0 when ... > ... is false | +| 17 | x < 0+0 when ... < ... is true | +| 17 | x >= 0+0 when ... < ... is false | +| 17 | y < 1+1 when ... > ... is false | +| 17 | y < (long)...+1 when ... > ... is false | +| 17 | y >= 1+1 when ... > ... is true | +| 17 | y >= (long)...+1 when ... > ... is true | +| 18 | (bool)... != call to get+0 when (bool)... is true | +| 18 | (bool)... != call to get+0 when call to get is true | +| 18 | (bool)... == call to get+0 when (bool)... is false | +| 18 | (bool)... == call to get+0 when call to get is false | +| 18 | call to get != (bool)...+0 when (bool)... is true | +| 18 | call to get != (bool)...+0 when call to get is true | +| 18 | call to get != call to get+0 when (bool)... is true | +| 18 | call to get != call to get+0 when call to get is true | +| 18 | call to get == (bool)...+0 when (bool)... is false | +| 18 | call to get == (bool)...+0 when call to get is false | +| 18 | call to get == call to get+0 when (bool)... is false | +| 18 | call to get == call to get+0 when call to get is false | +| 26 | 0 < x+0 when ... > ... is true | +| 26 | 0 >= x+0 when ... > ... is false | +| 26 | x < 0+1 when ... > ... is false | +| 26 | x >= 0+1 when ... > ... is true | +| 31 | - ... != x+0 when ... == ... is false | +| 31 | - ... == x+0 when ... == ... is true | +| 31 | x != - ...+0 when ... == ... is false | +| 31 | x == - ...+0 when ... == ... is true | +| 34 | 10 < j+1 when ... < ... is false | +| 34 | 10 >= j+1 when ... < ... is true | +| 34 | j < 10+0 when ... < ... is true | +| 34 | j >= 10+0 when ... < ... is false | +| 42 | 10 < j+1 when ... < ... is false | +| 42 | 10 >= j+1 when ... < ... is true | +| 42 | j < 10+0 when ... < ... is true | +| 42 | j >= 10+0 when ... < ... is false | +| 44 | 0 < z+0 when ... > ... is true | +| 44 | 0 >= z+0 when ... > ... is false | +| 44 | z < 0+1 when ... > ... is false | +| 44 | z >= 0+1 when ... > ... is true | +| 45 | 0 < y+0 when ... > ... is true | +| 45 | 0 >= y+0 when ... > ... is false | +| 45 | (long)... < y+0 when ... > ... is true | +| 45 | (long)... >= y+0 when ... > ... is false | +| 45 | y < 0+1 when ... > ... is false | +| 45 | y < (long)...+1 when ... > ... is false | +| 45 | y >= 0+1 when ... > ... is true | +| 45 | y >= (long)...+1 when ... > ... is true | +| 58 | 0 != x+0 when ... == ... is false | +| 58 | 0 < y+1 when ... < ... is false | +| 58 | 0 == x+0 when ... == ... is true | +| 58 | 0 >= y+1 when ... < ... is true | +| 58 | (long)... < y+1 when ... < ... is false | +| 58 | (long)... >= y+1 when ... < ... is true | +| 58 | x != 0+0 when ... == ... is false | +| 58 | x == 0+0 when ... == ... is true | +| 58 | y < 0+0 when ... < ... is true | +| 58 | y < (long)...+0 when ... < ... is true | +| 58 | y >= 0+0 when ... < ... is false | +| 58 | y >= (long)...+0 when ... < ... is false | +| 75 | 0 != x+0 when ... == ... is false | +| 75 | 0 == x+0 when ... == ... is true | +| 75 | x != 0+0 when ... == ... is false | +| 75 | x == 0+0 when ... == ... is true | +| 85 | 0 != x+0 when ... == ... is false | +| 85 | 0 != y+0 when ... != ... is true | +| 85 | 0 == x+0 when ... == ... is true | +| 85 | 0 == y+0 when ... != ... is false | +| 85 | (long)... != y+0 when ... != ... is true | +| 85 | (long)... == y+0 when ... != ... is false | +| 85 | x != 0+0 when ... == ... is false | +| 85 | x == 0+0 when ... == ... is true | +| 85 | y != 0+0 when ... != ... is true | +| 85 | y != (long)...+0 when ... != ... is true | +| 85 | y == 0+0 when ... != ... is false | +| 85 | y == (long)...+0 when ... != ... is false | +| 94 | 0 != x+0 when ... != ... is true | +| 94 | 0 == x+0 when ... != ... is false | +| 94 | x != 0+0 when ... != ... is true | +| 94 | x == 0+0 when ... != ... is false | +| 102 | 10 < j+1 when ... < ... is false | +| 102 | 10 >= j+1 when ... < ... is true | +| 102 | j < 10+0 when ... < ... is true | +| 102 | j >= 10+0 when ... < ... is false | +| 109 | 0 != x+0 when ... == ... is false | +| 109 | 0 < y+1 when ... < ... is false | +| 109 | 0 == x+0 when ... == ... is true | +| 109 | 0 >= y+1 when ... < ... is true | +| 109 | (long)... < y+1 when ... < ... is false | +| 109 | (long)... >= y+1 when ... < ... is true | +| 109 | x != 0+0 when ... == ... is false | +| 109 | x == 0+0 when ... == ... is true | +| 109 | y < 0+0 when ... < ... is true | +| 109 | y < (long)...+0 when ... < ... is true | +| 109 | y >= 0+0 when ... < ... is false | +| 109 | y >= (long)...+0 when ... < ... is false | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.ql new file mode 100644 index 000000000000..4f390935a984 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.ql @@ -0,0 +1,30 @@ +/** + * @name Guards comparison test + * @description List comparison parts. + * @kind test + */ + +import cpp +import semmle.code.cpp.controlflow.IRGuards + +Element clearConversions(Element e) { + if e instanceof Conversion + then result = e.(Conversion).getExpr*() + else result = e +} + +from IRGuardCondition guard, Instruction left, Instruction right, int k, string which, string op, string msg +where +(exists(boolean sense | sense = true and which = "true" or sense = false and which = "false" | + guard.comparesLt(left, right, k, true, sense) and op = " < " + or + guard.comparesLt(left, right, k, false, sense) and op = " >= " + or + guard.comparesEq(left, right, k, true, sense) and op = " == " + or + guard.comparesEq(left, right, k, false, sense) and op = " != " + ) +) +and msg = clearConversions(left.getAST()) + op + clearConversions(right.getAST()) + "+" + k + " when " + clearConversions(guard.getAST()) + " is " + which + +select guard.getLocation().getStartLine(), msg \ No newline at end of file diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected new file mode 100644 index 000000000000..41ac7f7254c4 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected @@ -0,0 +1,85 @@ +| test.c:7:9:7:13 | ... > ... | false | 11 | 11 | +| test.c:7:9:7:13 | ... > ... | true | 8 | 8 | +| test.c:17:8:17:12 | ... < ... | true | 17 | 17 | +| test.c:17:8:17:12 | ... < ... | true | 18 | 18 | +| test.c:17:17:17:21 | ... > ... | true | 18 | 18 | +| test.c:26:11:26:15 | ... > ... | false | 2 | 2 | +| test.c:26:11:26:15 | ... > ... | false | 31 | 31 | +| test.c:26:11:26:15 | ... > ... | false | 34 | 34 | +| test.c:26:11:26:15 | ... > ... | false | 35 | 35 | +| test.c:26:11:26:15 | ... > ... | false | 39 | 39 | +| test.c:26:11:26:15 | ... > ... | false | 42 | 42 | +| test.c:26:11:26:15 | ... > ... | false | 43 | 43 | +| test.c:26:11:26:15 | ... > ... | false | 45 | 45 | +| test.c:26:11:26:15 | ... > ... | false | 46 | 46 | +| test.c:26:11:26:15 | ... > ... | false | 49 | 49 | +| test.c:26:11:26:15 | ... > ... | false | 52 | 52 | +| test.c:26:11:26:15 | ... > ... | false | 56 | 56 | +| test.c:26:11:26:15 | ... > ... | false | 58 | 58 | +| test.c:26:11:26:15 | ... > ... | false | 59 | 59 | +| test.c:26:11:26:15 | ... > ... | false | 62 | 62 | +| test.c:26:11:26:15 | ... > ... | true | 27 | 27 | +| test.c:34:16:34:21 | ... < ... | false | 2 | 2 | +| test.c:34:16:34:21 | ... < ... | false | 39 | 39 | +| test.c:34:16:34:21 | ... < ... | false | 42 | 42 | +| test.c:34:16:34:21 | ... < ... | false | 43 | 43 | +| test.c:34:16:34:21 | ... < ... | false | 45 | 45 | +| test.c:34:16:34:21 | ... < ... | false | 46 | 46 | +| test.c:34:16:34:21 | ... < ... | false | 49 | 49 | +| test.c:34:16:34:21 | ... < ... | false | 52 | 52 | +| test.c:34:16:34:21 | ... < ... | false | 56 | 56 | +| test.c:34:16:34:21 | ... < ... | false | 58 | 58 | +| test.c:34:16:34:21 | ... < ... | false | 59 | 59 | +| test.c:34:16:34:21 | ... < ... | false | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | true | 35 | 35 | +| test.c:42:16:42:21 | ... < ... | true | 42 | 42 | +| test.c:42:16:42:21 | ... < ... | true | 43 | 43 | +| test.c:42:16:42:21 | ... < ... | true | 45 | 45 | +| test.c:42:16:42:21 | ... < ... | true | 46 | 46 | +| test.c:42:16:42:21 | ... < ... | true | 49 | 49 | +| test.c:42:16:42:21 | ... < ... | true | 52 | 52 | +| test.c:44:12:44:16 | ... > ... | false | 52 | 52 | +| test.c:44:12:44:16 | ... > ... | true | 45 | 45 | +| test.c:44:12:44:16 | ... > ... | true | 46 | 46 | +| test.c:44:12:44:16 | ... > ... | true | 49 | 49 | +| test.c:45:16:45:20 | ... > ... | false | 49 | 49 | +| test.c:45:16:45:20 | ... > ... | true | 46 | 46 | +| test.c:58:9:58:14 | ... == ... | false | 58 | 58 | +| test.c:58:9:58:14 | ... == ... | false | 62 | 62 | +| test.c:58:19:58:23 | ... < ... | false | 62 | 62 | +| test.c:75:9:75:14 | ... == ... | false | 79 | 79 | +| test.c:75:9:75:14 | ... == ... | true | 76 | 76 | +| test.c:85:8:85:13 | ... == ... | true | 85 | 85 | +| test.c:85:8:85:13 | ... == ... | true | 86 | 86 | +| test.c:85:18:85:23 | ... != ... | true | 86 | 86 | +| test.c:94:11:94:16 | ... != ... | false | 70 | 70 | +| test.c:94:11:94:16 | ... != ... | false | 99 | 99 | +| test.c:94:11:94:16 | ... != ... | false | 102 | 102 | +| test.c:94:11:94:16 | ... != ... | false | 103 | 103 | +| test.c:94:11:94:16 | ... != ... | false | 107 | 107 | +| test.c:94:11:94:16 | ... != ... | false | 109 | 109 | +| test.c:94:11:94:16 | ... != ... | false | 110 | 110 | +| test.c:94:11:94:16 | ... != ... | false | 113 | 113 | +| test.c:94:11:94:16 | ... != ... | true | 95 | 95 | +| test.c:102:16:102:21 | ... < ... | false | 70 | 70 | +| test.c:102:16:102:21 | ... < ... | false | 107 | 107 | +| test.c:102:16:102:21 | ... < ... | false | 109 | 109 | +| test.c:102:16:102:21 | ... < ... | false | 110 | 110 | +| test.c:102:16:102:21 | ... < ... | false | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | true | 103 | 103 | +| test.c:109:9:109:14 | ... == ... | false | 109 | 109 | +| test.c:109:9:109:14 | ... == ... | false | 113 | 113 | +| test.c:109:19:109:23 | ... < ... | false | 113 | 113 | +| test.c:126:7:126:7 | 1 | true | 126 | 126 | +| test.c:126:7:126:7 | 1 | true | 127 | 127 | +| test.c:126:12:126:26 | call to test3_condition | true | 127 | 127 | +| test.c:131:7:131:7 | b | true | 132 | 132 | +| test.c:137:7:137:7 | 0 | true | 138 | 138 | +| test.c:137:7:137:7 | 0 | true | 139 | 139 | +| test.c:138:9:138:9 | i | true | 139 | 139 | +| test.c:146:8:146:8 | x | false | 147 | 147 | +| test.cpp:18:8:18:12 | (bool)... | true | 0 | 0 | +| test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | true | 30 | 30 | +| test.cpp:31:7:31:13 | ... == ... | true | 32 | 32 | +| test.cpp:42:13:42:20 | call to getABool | true | 44 | 44 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.ql new file mode 100644 index 000000000000..a9864da941c1 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.ql @@ -0,0 +1,16 @@ +/** + * @name Guards control test + * @description List which guards control which blocks + * @kind test + */ + +import cpp +import semmle.code.cpp.controlflow.IRGuards + +from IRGuardCondition guard, boolean sense, int start, int end +where +exists(IRBlock block | + guard.controls(block, sense) and + block.getLocation().hasLocationInfo(_, start, _, end, _) +) +select guard.getAST(), sense, start, end diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.expected new file mode 100644 index 000000000000..8788337ccc3b --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.expected @@ -0,0 +1,152 @@ +| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | < | test.c:7:13:7:13 | 0 | 1 | 11 | 11 | +| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | >= | test.c:7:13:7:13 | 0 | 1 | 8 | 8 | +| test.c:7:9:7:13 | ... > ... | test.c:7:13:7:13 | 0 | < | test.c:7:9:7:9 | x | 0 | 8 | 8 | +| test.c:7:9:7:13 | ... > ... | test.c:7:13:7:13 | 0 | >= | test.c:7:9:7:9 | x | 0 | 11 | 11 | +| test.c:17:8:17:12 | ... < ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 17 | 17 | +| test.c:17:8:17:12 | ... < ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 18 | 18 | +| test.c:17:8:17:12 | ... < ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 17 | 17 | +| test.c:17:8:17:12 | ... < ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 18 | 18 | +| test.c:17:17:17:21 | ... > ... | test.c:17:17:17:17 | y | >= | test.c:17:21:17:21 | (long)... | 1 | 18 | 18 | +| test.c:17:17:17:21 | ... > ... | test.c:17:21:17:21 | (long)... | < | test.c:17:17:17:17 | y | 0 | 18 | 18 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 2 | 2 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 31 | 31 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 34 | 34 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 35 | 35 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 39 | 39 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 42 | 42 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 43 | 43 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 45 | 45 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 46 | 46 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 49 | 49 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 52 | 52 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 56 | 56 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 58 | 58 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 59 | 59 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 62 | 62 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | >= | test.c:26:15:26:15 | 0 | 1 | 27 | 27 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | < | test.c:26:11:26:11 | x | 0 | 27 | 27 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 2 | 2 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 31 | 31 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 34 | 34 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 35 | 35 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 39 | 39 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 42 | 42 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 43 | 43 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 45 | 45 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 46 | 46 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 49 | 49 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 52 | 52 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 56 | 56 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 58 | 58 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 59 | 59 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | < | test.c:34:20:34:21 | 10 | 0 | 35 | 35 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 2 | 2 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 39 | 39 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 42 | 42 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 43 | 43 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 45 | 45 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 46 | 46 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 49 | 49 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 52 | 52 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 56 | 56 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 58 | 58 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 59 | 59 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 2 | 2 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 39 | 39 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 42 | 42 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 43 | 43 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 45 | 45 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 46 | 46 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 49 | 49 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 52 | 52 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 56 | 56 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 58 | 58 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 59 | 59 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | >= | test.c:34:16:34:16 | j | 1 | 35 | 35 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 42 | 42 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 43 | 43 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 45 | 45 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 46 | 46 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 49 | 49 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 52 | 52 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 42 | 42 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 43 | 43 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 45 | 45 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 46 | 46 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 49 | 49 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 52 | 52 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | < | test.c:44:16:44:16 | 0 | 1 | 52 | 52 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 45 | 45 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 46 | 46 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 49 | 49 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 45 | 45 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 46 | 46 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 49 | 49 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | >= | test.c:44:12:44:12 | z | 0 | 52 | 52 | +| test.c:45:16:45:20 | ... > ... | test.c:45:16:45:16 | y | < | test.c:45:20:45:20 | (long)... | 1 | 49 | 49 | +| test.c:45:16:45:20 | ... > ... | test.c:45:16:45:16 | y | >= | test.c:45:20:45:20 | (long)... | 1 | 46 | 46 | +| test.c:45:16:45:20 | ... > ... | test.c:45:20:45:20 | (long)... | < | test.c:45:16:45:16 | y | 0 | 46 | 46 | +| test.c:45:16:45:20 | ... > ... | test.c:45:20:45:20 | (long)... | >= | test.c:45:16:45:16 | y | 0 | 49 | 49 | +| test.c:58:9:58:14 | ... == ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 58 | 58 | +| test.c:58:9:58:14 | ... == ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 62 | 62 | +| test.c:58:9:58:14 | ... == ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 58 | 58 | +| test.c:58:9:58:14 | ... == ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 62 | 62 | +| test.c:58:19:58:23 | ... < ... | test.c:58:19:58:19 | y | >= | test.c:58:23:58:23 | (long)... | 0 | 62 | 62 | +| test.c:58:19:58:23 | ... < ... | test.c:58:23:58:23 | (long)... | < | test.c:58:19:58:19 | y | 1 | 62 | 62 | +| test.c:75:9:75:14 | ... == ... | test.c:75:9:75:9 | x | != | test.c:75:14:75:14 | 0 | 0 | 79 | 79 | +| test.c:75:9:75:14 | ... == ... | test.c:75:9:75:9 | x | == | test.c:75:14:75:14 | 0 | 0 | 76 | 76 | +| test.c:75:9:75:14 | ... == ... | test.c:75:14:75:14 | 0 | != | test.c:75:9:75:9 | x | 0 | 79 | 79 | +| test.c:75:9:75:14 | ... == ... | test.c:75:14:75:14 | 0 | == | test.c:75:9:75:9 | x | 0 | 76 | 76 | +| test.c:85:8:85:13 | ... == ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 85 | 85 | +| test.c:85:8:85:13 | ... == ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 86 | 86 | +| test.c:85:8:85:13 | ... == ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 85 | 85 | +| test.c:85:8:85:13 | ... == ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 86 | 86 | +| test.c:85:18:85:23 | ... != ... | test.c:85:18:85:18 | y | != | test.c:85:23:85:23 | (long)... | 0 | 86 | 86 | +| test.c:85:18:85:23 | ... != ... | test.c:85:23:85:23 | (long)... | != | test.c:85:18:85:18 | y | 0 | 86 | 86 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | != | test.c:94:16:94:16 | 0 | 0 | 95 | 95 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 70 | 70 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 99 | 99 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 102 | 102 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 103 | 103 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 107 | 107 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 109 | 109 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 110 | 110 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 113 | 113 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | != | test.c:94:11:94:11 | x | 0 | 95 | 95 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 70 | 70 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 99 | 99 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 102 | 102 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 103 | 103 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 107 | 107 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 109 | 109 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 110 | 110 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | < | test.c:102:20:102:21 | 10 | 0 | 103 | 103 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 70 | 70 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 107 | 107 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 109 | 109 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 110 | 110 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 70 | 70 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 107 | 107 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 109 | 109 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 110 | 110 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | >= | test.c:102:16:102:16 | j | 1 | 103 | 103 | +| test.c:109:9:109:14 | ... == ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 109 | 109 | +| test.c:109:9:109:14 | ... == ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 113 | 113 | +| test.c:109:9:109:14 | ... == ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 109 | 109 | +| test.c:109:9:109:14 | ... == ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 113 | 113 | +| test.c:109:19:109:23 | ... < ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | (long)... | 0 | 113 | 113 | +| test.c:109:19:109:23 | ... < ... | test.c:109:23:109:23 | (long)... | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | +| test.cpp:18:8:18:12 | (bool)... | test.cpp:18:8:18:10 | call to get | != | test.cpp:18:8:18:12 | (bool)... | 0 | 0 | 0 | +| test.cpp:18:8:18:12 | (bool)... | test.cpp:18:8:18:12 | (bool)... | != | test.cpp:18:8:18:10 | call to get | 0 | 0 | 0 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 32 | 32 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | != | test.cpp:31:7:31:7 | x | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 30 | 30 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 32 | 32 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.ql new file mode 100644 index 000000000000..a13d4cf2a42e --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.ql @@ -0,0 +1,23 @@ +/** + * @name Guards control test + * @description List which guards ensure which inequalities apply to which blocks + * @kind test + */ + +import cpp +import semmle.code.cpp.controlflow.IRGuards + + +from IRGuardCondition guard, Instruction left, Instruction right, int k, int start, int end, string op +where +exists(IRBlock block | + guard.ensuresLt(left, right, k, block, true) and op = "<" + or + guard.ensuresLt(left, right, k, block, false) and op = ">=" + or + guard.ensuresEq(left, right, k, block, true) and op = "==" + or + guard.ensuresEq(left, right, k, block, false) and op = "!=" | + block.getLocation().hasLocationInfo(_, start, _, end, _) +) +select guard.getAST(), left.getAST(), op, right.getAST(), k, start, end From 0273b20743abaf82c76fd4ce957b540246712a95 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Fri, 14 Sep 2018 11:11:22 -0700 Subject: [PATCH 05/33] C++: make internal classes private --- cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll index d8e7e1c12742..6e76cbec2dc1 100644 --- a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll +++ b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll @@ -63,7 +63,7 @@ class GuardCondition extends Expr { abstract cached predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual); } -class GuardConditionFromBinaryLogicalOperator extends GuardCondition { +private class GuardConditionFromBinaryLogicalOperator extends GuardCondition { GuardConditionFromBinaryLogicalOperator() { exists(GuardCondition gc | this.(BinaryLogicalOperation).getAnOperand()= gc @@ -106,7 +106,7 @@ class GuardConditionFromBinaryLogicalOperator extends GuardCondition { } } -class GuardConditionFromShortCircuitNot extends GuardCondition, NotExpr { +private class GuardConditionFromShortCircuitNot extends GuardCondition, NotExpr { GuardConditionFromShortCircuitNot() { not exists (Instruction inst | this.getFullyConverted() = inst.getAST()) and exists(IRGuardCondition ir | getOperand() = ir.getAST()) @@ -133,7 +133,7 @@ class GuardConditionFromShortCircuitNot extends GuardCondition, NotExpr { } } -class GuardConditionFromIR extends GuardCondition { +private class GuardConditionFromIR extends GuardCondition { IRGuardCondition ir; GuardConditionFromIR() { From b5cd48d8197c2314e099afe49f093aab3e610100 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Fri, 14 Sep 2018 11:18:51 -0700 Subject: [PATCH 06/33] C++: comments on new classes and predicates --- .../src/semmle/code/cpp/controlflow/IRGuards.qll | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll index 6e76cbec2dc1..b0ab12be0f8f 100644 --- a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll +++ b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll @@ -2,7 +2,7 @@ import cpp import semmle.code.cpp.ir.IR /** - * A Boolean condition in the IR that guards one or more basic blocks. This includes + * A Boolean condition in the AST that guards one or more basic blocks. This includes * operands of logical operators but not switch statements. */ class GuardCondition extends Expr { @@ -63,6 +63,9 @@ class GuardCondition extends Expr { abstract cached predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual); } +/** + * A binary logical operator in the AST that guards one or more basic blocks. + */ private class GuardConditionFromBinaryLogicalOperator extends GuardCondition { GuardConditionFromBinaryLogicalOperator() { exists(GuardCondition gc | @@ -106,6 +109,10 @@ private class GuardConditionFromBinaryLogicalOperator extends GuardCondition { } } +/** + * A `!` operator in the AST that guards one or more basic blocks, and does not have a corresponding + * IR instruction. + */ private class GuardConditionFromShortCircuitNot extends GuardCondition, NotExpr { GuardConditionFromShortCircuitNot() { not exists (Instruction inst | this.getFullyConverted() = inst.getAST()) and @@ -132,7 +139,10 @@ private class GuardConditionFromShortCircuitNot extends GuardCondition, NotExpr getOperand().(GuardCondition).ensuresEq(left, right, k, block, testIsTrue.booleanNot()) } } - +/** + * A Boolean condition in the AST that guards one or more basic blocks and has a corresponding IR + * instruction. + */ private class GuardConditionFromIR extends GuardCondition { IRGuardCondition ir; @@ -463,7 +473,7 @@ private int int_value(Instruction i) { result = i.(IntegerConstantInstruction).getValue().toInt() } - +/** Gets the underlying expression of `e`. */ private Expr remove_conversions(Expr e) { if e instanceof Conversion then result = e.(Conversion).getExpr*() and From d6cea1b2038cbeda2588fa3bd08f5c351f925525 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Fri, 14 Sep 2018 16:24:10 -0700 Subject: [PATCH 07/33] C++: Add class and predicates to other IR stages --- .../cpp/ir/implementation/raw/Instruction.qll | 66 +++++++++++++++++-- .../unaliased_ssa/Instruction.qll | 66 +++++++++++++++++-- 2 files changed, 124 insertions(+), 8 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll index e63fd979def7..d01378e32cae 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll @@ -967,28 +967,86 @@ class CompareNEInstruction extends CompareInstruction { } } -class CompareLTInstruction extends CompareInstruction { +class RelationalInstruction extends CompareInstruction { + RelationalInstruction() { + opcode instanceof RelationalOpcode + } + + abstract Instruction getGreaterOperand(); + abstract Instruction getLesserOperand(); + abstract predicate isStrict(); +} + +class CompareLTInstruction extends RelationalInstruction { CompareLTInstruction() { opcode instanceof Opcode::CompareLT } + + override Instruction getLesserOperand() { + result = getLeftOperand() + } + + override Instruction getGreaterOperand() { + result = getRightOperand() + } + + override predicate isStrict() { + any() + } } -class CompareGTInstruction extends CompareInstruction { +class CompareGTInstruction extends RelationalInstruction { CompareGTInstruction() { opcode instanceof Opcode::CompareGT } + + override Instruction getLesserOperand() { + result = getRightOperand() + } + + override Instruction getGreaterOperand() { + result = getLeftOperand() + } + + override predicate isStrict() { + any() + } } -class CompareLEInstruction extends CompareInstruction { +class CompareLEInstruction extends RelationalInstruction { CompareLEInstruction() { opcode instanceof Opcode::CompareLE } + + override Instruction getLesserOperand() { + result = getLeftOperand() + } + + override Instruction getGreaterOperand() { + result = getRightOperand() + } + + override predicate isStrict() { + none() + } } -class CompareGEInstruction extends CompareInstruction { +class CompareGEInstruction extends RelationalInstruction { CompareGEInstruction() { opcode instanceof Opcode::CompareGE } + + override Instruction getLesserOperand() { + result = getRightOperand() + } + + override Instruction getGreaterOperand() { + result = getLeftOperand() + } + + override predicate isStrict() { + none() + } } class SwitchInstruction extends Instruction { diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll index e63fd979def7..d01378e32cae 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll @@ -967,28 +967,86 @@ class CompareNEInstruction extends CompareInstruction { } } -class CompareLTInstruction extends CompareInstruction { +class RelationalInstruction extends CompareInstruction { + RelationalInstruction() { + opcode instanceof RelationalOpcode + } + + abstract Instruction getGreaterOperand(); + abstract Instruction getLesserOperand(); + abstract predicate isStrict(); +} + +class CompareLTInstruction extends RelationalInstruction { CompareLTInstruction() { opcode instanceof Opcode::CompareLT } + + override Instruction getLesserOperand() { + result = getLeftOperand() + } + + override Instruction getGreaterOperand() { + result = getRightOperand() + } + + override predicate isStrict() { + any() + } } -class CompareGTInstruction extends CompareInstruction { +class CompareGTInstruction extends RelationalInstruction { CompareGTInstruction() { opcode instanceof Opcode::CompareGT } + + override Instruction getLesserOperand() { + result = getRightOperand() + } + + override Instruction getGreaterOperand() { + result = getLeftOperand() + } + + override predicate isStrict() { + any() + } } -class CompareLEInstruction extends CompareInstruction { +class CompareLEInstruction extends RelationalInstruction { CompareLEInstruction() { opcode instanceof Opcode::CompareLE } + + override Instruction getLesserOperand() { + result = getLeftOperand() + } + + override Instruction getGreaterOperand() { + result = getRightOperand() + } + + override predicate isStrict() { + none() + } } -class CompareGEInstruction extends CompareInstruction { +class CompareGEInstruction extends RelationalInstruction { CompareGEInstruction() { opcode instanceof Opcode::CompareGE } + + override Instruction getLesserOperand() { + result = getRightOperand() + } + + override Instruction getGreaterOperand() { + result = getLeftOperand() + } + + override predicate isStrict() { + none() + } } class SwitchInstruction extends Instruction { From e40ce91e7e4668a7dd356942069be9bb8911817f Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Fri, 14 Sep 2018 16:35:13 -0700 Subject: [PATCH 08/33] C++: document new IR class and predicates --- .../aliased_ssa/Instruction.qll | 20 ++++++++++++++++++- .../cpp/ir/implementation/raw/Instruction.qll | 20 ++++++++++++++++++- .../unaliased_ssa/Instruction.qll | 20 ++++++++++++++++++- 3 files changed, 57 insertions(+), 3 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll index d01378e32cae..510899f16a35 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll @@ -967,13 +967,31 @@ class CompareNEInstruction extends CompareInstruction { } } +/** + * Represents an instruction that does a relative comparison of two values, such as `<` or `>=`. + */ class RelationalInstruction extends CompareInstruction { RelationalInstruction() { opcode instanceof RelationalOpcode } - + /** + * Gets the operand on the "greater" (or "greater-or-equal") side + * of this relational instruction, that is, the side that is larger + * if the overall instruction evaluates to `true`; for example on + * `x <= 20` this is the `20`, and on `y > 0` it is `y`. + */ abstract Instruction getGreaterOperand(); + + /** + * Gets the operand on the "lesser" (or "lesser-or-equal") side + * of this relational instruction, that is, the side that is smaller + * if the overall instruction evaluates to `true`; for example on + * `x <= 20` this is `x`, and on `y > 0` it is the `0`. + */ abstract Instruction getLesserOperand(); + /** + * Holds if this relational instruction is strict (is not an "or-equal" instruction). + */ abstract predicate isStrict(); } diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll index d01378e32cae..510899f16a35 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll @@ -967,13 +967,31 @@ class CompareNEInstruction extends CompareInstruction { } } +/** + * Represents an instruction that does a relative comparison of two values, such as `<` or `>=`. + */ class RelationalInstruction extends CompareInstruction { RelationalInstruction() { opcode instanceof RelationalOpcode } - + /** + * Gets the operand on the "greater" (or "greater-or-equal") side + * of this relational instruction, that is, the side that is larger + * if the overall instruction evaluates to `true`; for example on + * `x <= 20` this is the `20`, and on `y > 0` it is `y`. + */ abstract Instruction getGreaterOperand(); + + /** + * Gets the operand on the "lesser" (or "lesser-or-equal") side + * of this relational instruction, that is, the side that is smaller + * if the overall instruction evaluates to `true`; for example on + * `x <= 20` this is `x`, and on `y > 0` it is the `0`. + */ abstract Instruction getLesserOperand(); + /** + * Holds if this relational instruction is strict (is not an "or-equal" instruction). + */ abstract predicate isStrict(); } diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll index d01378e32cae..510899f16a35 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll @@ -967,13 +967,31 @@ class CompareNEInstruction extends CompareInstruction { } } +/** + * Represents an instruction that does a relative comparison of two values, such as `<` or `>=`. + */ class RelationalInstruction extends CompareInstruction { RelationalInstruction() { opcode instanceof RelationalOpcode } - + /** + * Gets the operand on the "greater" (or "greater-or-equal") side + * of this relational instruction, that is, the side that is larger + * if the overall instruction evaluates to `true`; for example on + * `x <= 20` this is the `20`, and on `y > 0` it is `y`. + */ abstract Instruction getGreaterOperand(); + + /** + * Gets the operand on the "lesser" (or "lesser-or-equal") side + * of this relational instruction, that is, the side that is smaller + * if the overall instruction evaluates to `true`; for example on + * `x <= 20` this is `x`, and on `y > 0` it is the `0`. + */ abstract Instruction getLesserOperand(); + /** + * Holds if this relational instruction is strict (is not an "or-equal" instruction). + */ abstract predicate isStrict(); } From 755e21d3556155c91ddf873cff7b6ce8363229f7 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Tue, 18 Sep 2018 12:54:24 -0700 Subject: [PATCH 09/33] C++: improve conversion handling in IRGuards.qll --- cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll | 6 +++--- .../library-tests/controlflow/guards-ir/ASTGuards.expected | 1 - .../controlflow/guards-ir/ASTGuardsCompare.expected | 2 -- .../controlflow/guards-ir/ASTGuardsControl.expected | 1 - .../controlflow/guards-ir/ASTGuardsEnsure.expected | 1 - 5 files changed, 3 insertions(+), 8 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll index b0ab12be0f8f..df0f6eb94823 100644 --- a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll +++ b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll @@ -7,7 +7,7 @@ import semmle.code.cpp.ir.IR */ class GuardCondition extends Expr { GuardCondition() { - exists(IRGuardCondition ir | this.getFullyConverted() = ir.getAST()) + exists(IRGuardCondition ir | this = remove_conversions(ir.getAST())) or // no binary operators in the IR exists(Instruction ir | @@ -147,7 +147,7 @@ private class GuardConditionFromIR extends GuardCondition { IRGuardCondition ir; GuardConditionFromIR() { - this.getFullyConverted() = ir.getAST() + this = remove_conversions(ir.getAST()) } override predicate controls(BasicBlock controlled, boolean testIsTrue) { /* This condition must determine the flow of control; that is, this @@ -476,7 +476,7 @@ private int int_value(Instruction i) { /** Gets the underlying expression of `e`. */ private Expr remove_conversions(Expr e) { if e instanceof Conversion - then result = e.(Conversion).getExpr*() and + then result = e.(Conversion).getExpr+() and not result instanceof Conversion else result = e } diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected index b73e94106192..b73e7064339e 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected @@ -28,6 +28,5 @@ | test.c:146:7:146:8 | ! ... | | test.c:146:8:146:8 | x | | test.cpp:18:8:18:10 | call to get | -| test.cpp:18:8:18:12 | (bool)... | | test.cpp:31:7:31:13 | ... == ... | | test.cpp:42:13:42:20 | call to getABool | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected index 99339f723a61..d786c284d473 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected @@ -14,9 +14,7 @@ | 17 | y < 1+1 when ... > ... is false | | 17 | y >= 1+1 when ... && ... is true | | 17 | y >= 1+1 when ... > ... is true | -| 18 | call to get != call to get+0 when (bool)... is true | | 18 | call to get != call to get+0 when call to get is true | -| 18 | call to get == call to get+0 when (bool)... is false | | 18 | call to get == call to get+0 when call to get is false | | 26 | 0 < x+0 when ... > ... is true | | 26 | 0 >= x+0 when ... > ... is false | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected index f5fd0f184e48..a2fecbcbbee7 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected @@ -83,7 +83,6 @@ | test.c:146:7:146:8 | ! ... | true | 146 | 147 | | test.c:146:8:146:8 | x | false | 146 | 147 | | test.cpp:18:8:18:10 | call to get | true | 19 | 19 | -| test.cpp:18:8:18:12 | (bool)... | true | 19 | 19 | | test.cpp:31:7:31:13 | ... == ... | false | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | | test.cpp:31:7:31:13 | ... == ... | true | 30 | 30 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected index 9186ab1fa1ea..8eb3eb83e277 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected @@ -155,7 +155,6 @@ | test.c:109:19:109:23 | ... < ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | 0 | 0 | 113 | 113 | | test.c:109:19:109:23 | ... < ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | | test.cpp:18:8:18:10 | call to get | test.cpp:18:8:18:10 | call to get | != | test.cpp:18:8:18:10 | call to get | 0 | 19 | 19 | -| test.cpp:18:8:18:12 | (bool)... | test.cpp:18:8:18:10 | call to get | != | test.cpp:18:8:18:10 | call to get | 0 | 19 | 19 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 34 | 34 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | From 4c9414408913a658606218c68625dae82d761a9e Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Tue, 18 Sep 2018 14:09:56 -0700 Subject: [PATCH 10/33] C++: remove abstract classes in IR --- .../semmle/code/cpp/controlflow/IRGuards.qll | 20 ++++++++++++++----- .../aliased_ssa/Instruction.qll | 12 ++++++++--- .../cpp/ir/implementation/raw/Instruction.qll | 12 ++++++++--- .../unaliased_ssa/Instruction.qll | 12 ++++++++--- 4 files changed, 42 insertions(+), 14 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll index df0f6eb94823..dc9d6d435baa 100644 --- a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll +++ b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll @@ -46,21 +46,31 @@ class GuardCondition extends Expr { * being short-circuited) then it will only control blocks dominated by the * true (for `&&`) or false (for `||`) branch. */ - abstract cached predicate controls(BasicBlock controlled, boolean testIsTrue); + cached predicate controls(BasicBlock controlled, boolean testIsTrue) { + none() + } /** Holds if (determined by this guard) `left < right + k` evaluates to `isLessThan` if this expression evaluates to `testIsTrue`. */ - abstract cached predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue); + cached predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue) { + none() + } /** Holds if (determined by this guard) `left < right + k` must be `isLessThan` in `block`. If `isLessThan = false` then this implies `left >= right + k`. */ - abstract cached predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan); + cached predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan) { + none() + } /** Holds if (determined by this guard) `left == right + k` evaluates to `areEqual` if this expression evaluates to `testIsTrue`. */ - abstract cached predicate comparesEq(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue); + cached predicate comparesEq(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue) { + none() + } /** Holds if (determined by this guard) `left == right + k` must be `areEqual` in `block`. If `areEqual = false` then this implies `left != right + k`. */ - abstract cached predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual); + cached predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual) { + none() + } } /** diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll index 510899f16a35..a9a9d8190e67 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll @@ -980,7 +980,9 @@ class RelationalInstruction extends CompareInstruction { * if the overall instruction evaluates to `true`; for example on * `x <= 20` this is the `20`, and on `y > 0` it is `y`. */ - abstract Instruction getGreaterOperand(); + Instruction getGreaterOperand() { + none() + } /** * Gets the operand on the "lesser" (or "lesser-or-equal") side @@ -988,11 +990,15 @@ class RelationalInstruction extends CompareInstruction { * if the overall instruction evaluates to `true`; for example on * `x <= 20` this is `x`, and on `y > 0` it is the `0`. */ - abstract Instruction getLesserOperand(); + Instruction getLesserOperand() { + none() + } /** * Holds if this relational instruction is strict (is not an "or-equal" instruction). */ - abstract predicate isStrict(); + predicate isStrict() { + none() + } } class CompareLTInstruction extends RelationalInstruction { diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll index 510899f16a35..a9a9d8190e67 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll @@ -980,7 +980,9 @@ class RelationalInstruction extends CompareInstruction { * if the overall instruction evaluates to `true`; for example on * `x <= 20` this is the `20`, and on `y > 0` it is `y`. */ - abstract Instruction getGreaterOperand(); + Instruction getGreaterOperand() { + none() + } /** * Gets the operand on the "lesser" (or "lesser-or-equal") side @@ -988,11 +990,15 @@ class RelationalInstruction extends CompareInstruction { * if the overall instruction evaluates to `true`; for example on * `x <= 20` this is `x`, and on `y > 0` it is the `0`. */ - abstract Instruction getLesserOperand(); + Instruction getLesserOperand() { + none() + } /** * Holds if this relational instruction is strict (is not an "or-equal" instruction). */ - abstract predicate isStrict(); + predicate isStrict() { + none() + } } class CompareLTInstruction extends RelationalInstruction { diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll index 510899f16a35..a9a9d8190e67 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll @@ -980,7 +980,9 @@ class RelationalInstruction extends CompareInstruction { * if the overall instruction evaluates to `true`; for example on * `x <= 20` this is the `20`, and on `y > 0` it is `y`. */ - abstract Instruction getGreaterOperand(); + Instruction getGreaterOperand() { + none() + } /** * Gets the operand on the "lesser" (or "lesser-or-equal") side @@ -988,11 +990,15 @@ class RelationalInstruction extends CompareInstruction { * if the overall instruction evaluates to `true`; for example on * `x <= 20` this is `x`, and on `y > 0` it is the `0`. */ - abstract Instruction getLesserOperand(); + Instruction getLesserOperand() { + none() + } /** * Holds if this relational instruction is strict (is not an "or-equal" instruction). */ - abstract predicate isStrict(); + predicate isStrict() { + none() + } } class CompareLTInstruction extends RelationalInstruction { From cc97cf9297215d55d7713457a1f8b161e74b4717 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Tue, 18 Sep 2018 14:52:46 -0700 Subject: [PATCH 11/33] C++: add isReachableFromFunctionEntry --- cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll | 2 +- .../code/cpp/ir/implementation/aliased_ssa/IRBlock.qll | 8 ++++++++ .../src/semmle/code/cpp/ir/implementation/raw/IRBlock.qll | 8 ++++++++ .../code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll | 8 ++++++++ .../controlflow/guards-ir/ASTGuardsControl.expected | 1 + .../controlflow/guards-ir/IRGuardsControl.expected | 1 + 6 files changed, 27 insertions(+), 1 deletion(-) diff --git a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll index dc9d6d435baa..87045304da09 100644 --- a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll +++ b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll @@ -310,7 +310,7 @@ class IRGuardCondition extends Instruction { succ.dominates(controlled) and forall(IRBlock pred | pred.getASuccessor() = succ - | pred = thisblock or succ.dominates(pred)))) // removed reachability condition - is that OK? + | pred = thisblock or succ.dominates(pred) or not pred.isReachableFromFunctionEntry()))) } } diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll index c794c6cb288b..c51b05a073bb 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/IRBlock.qll @@ -89,4 +89,12 @@ class IRBlock extends TIRBlock { dominates(result.getAPredecessor()) and not strictlyDominates(result) } + + /** + * Holds if this block is reachable from the entry point of its function + */ + final predicate isReachableFromFunctionEntry() { + this = getFunctionIR().getEntryBlock() or + getAPredecessor().isReachableFromFunctionEntry() + } } diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRBlock.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRBlock.qll index c794c6cb288b..c51b05a073bb 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRBlock.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/IRBlock.qll @@ -89,4 +89,12 @@ class IRBlock extends TIRBlock { dominates(result.getAPredecessor()) and not strictlyDominates(result) } + + /** + * Holds if this block is reachable from the entry point of its function + */ + final predicate isReachableFromFunctionEntry() { + this = getFunctionIR().getEntryBlock() or + getAPredecessor().isReachableFromFunctionEntry() + } } diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll index c794c6cb288b..c51b05a073bb 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/IRBlock.qll @@ -89,4 +89,12 @@ class IRBlock extends TIRBlock { dominates(result.getAPredecessor()) and not strictlyDominates(result) } + + /** + * Holds if this block is reachable from the entry point of its function + */ + final predicate isReachableFromFunctionEntry() { + this = getFunctionIR().getEntryBlock() or + getAPredecessor().isReachableFromFunctionEntry() + } } diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected index a2fecbcbbee7..d4a5295b8771 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected @@ -87,4 +87,5 @@ | test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | | test.cpp:31:7:31:13 | ... == ... | true | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | true | 31 | 32 | +| test.cpp:42:13:42:20 | call to getABool | false | 53 | 53 | | test.cpp:42:13:42:20 | call to getABool | true | 43 | 45 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected index 41ac7f7254c4..3e8fbb42f1a1 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected @@ -82,4 +82,5 @@ | test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | | test.cpp:31:7:31:13 | ... == ... | true | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | true | 32 | 32 | +| test.cpp:42:13:42:20 | call to getABool | false | 53 | 53 | | test.cpp:42:13:42:20 | call to getABool | true | 44 | 44 | From 9011e1381bc952cd8d89b925f1bb20b0f4b8d0c9 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Thu, 20 Sep 2018 12:56:43 -0700 Subject: [PATCH 12/33] C++: handle conversions in IR to AST translation --- .../semmle/code/cpp/controlflow/IRGuards.qll | 28 +++++++------------ .../aliased_ssa/Instruction.qll | 12 ++++++-- .../aliased_ssa/internal/SSAConstruction.qll | 8 ++++-- .../cpp/ir/implementation/raw/Instruction.qll | 12 ++++++-- .../raw/internal/IRConstruction.qll | 14 +++++++++- .../unaliased_ssa/Instruction.qll | 12 ++++++-- .../internal/SSAConstruction.qll | 8 ++++-- 7 files changed, 65 insertions(+), 29 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll index 87045304da09..b470447788a8 100644 --- a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll +++ b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll @@ -7,7 +7,7 @@ import semmle.code.cpp.ir.IR */ class GuardCondition extends Expr { GuardCondition() { - exists(IRGuardCondition ir | this = remove_conversions(ir.getAST())) + exists(IRGuardCondition ir | this = ir.getUnconvertedResultExpression()) or // no binary operators in the IR exists(Instruction ir | @@ -157,7 +157,7 @@ private class GuardConditionFromIR extends GuardCondition { IRGuardCondition ir; GuardConditionFromIR() { - this = remove_conversions(ir.getAST()) + this = ir.getUnconvertedResultExpression() } override predicate controls(BasicBlock controlled, boolean testIsTrue) { /* This condition must determine the flow of control; that is, this @@ -168,8 +168,8 @@ private class GuardConditionFromIR extends GuardCondition { /** Holds if (determined by this guard) `left < right + k` evaluates to `isLessThan` if this expression evaluates to `testIsTrue`. */ override predicate comparesLt(Expr left, Expr right, int k, boolean isLessThan, boolean testIsTrue) { exists(Instruction li, Instruction ri | - remove_conversions(li.getAST()) = left and - remove_conversions(ri.getAST()) = right and + li.getUnconvertedResultExpression() = left and + ri.getUnconvertedResultExpression() = right and ir.comparesLt(li, ri, k, isLessThan, testIsTrue) ) } @@ -178,8 +178,8 @@ private class GuardConditionFromIR extends GuardCondition { If `isLessThan = false` then this implies `left >= right + k`. */ override predicate ensuresLt(Expr left, Expr right, int k, BasicBlock block, boolean isLessThan) { exists(Instruction li, Instruction ri, boolean testIsTrue | - remove_conversions(li.getAST()) = left and - remove_conversions(ri.getAST()) = right and + li.getUnconvertedResultExpression() = left and + ri.getUnconvertedResultExpression() = right and ir.comparesLt(li, ri, k, isLessThan, testIsTrue) and this.controls(block, testIsTrue) ) @@ -188,8 +188,8 @@ private class GuardConditionFromIR extends GuardCondition { /** Holds if (determined by this guard) `left == right + k` evaluates to `areEqual` if this expression evaluates to `testIsTrue`. */ override predicate comparesEq(Expr left, Expr right, int k, boolean areEqual, boolean testIsTrue) { exists(Instruction li, Instruction ri | - remove_conversions(li.getAST()) = left and - remove_conversions(ri.getAST()) = right and + li.getUnconvertedResultExpression() = left and + ri.getUnconvertedResultExpression() = right and ir.comparesEq(li, ri, k, areEqual, testIsTrue) ) } @@ -198,8 +198,8 @@ private class GuardConditionFromIR extends GuardCondition { If `areEqual = false` then this implies `left != right + k`. */ override predicate ensuresEq(Expr left, Expr right, int k, BasicBlock block, boolean areEqual) { exists(Instruction li, Instruction ri, boolean testIsTrue | - remove_conversions(li.getAST()) = left and - remove_conversions(ri.getAST()) = right and + li.getUnconvertedResultExpression() = left and + ri.getUnconvertedResultExpression() = right and ir.comparesEq(li, ri, k, areEqual, testIsTrue) and this.controls(block, testIsTrue) ) @@ -482,11 +482,3 @@ private predicate add_eq(CompareInstruction cmp, Instruction left, Instruction r private int int_value(Instruction i) { result = i.(IntegerConstantInstruction).getValue().toInt() } - -/** Gets the underlying expression of `e`. */ -private Expr remove_conversions(Expr e) { - if e instanceof Conversion - then result = e.(Conversion).getExpr+() and - not result instanceof Conversion - else result = e -} diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll index a9a9d8190e67..b00c479139d8 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll @@ -312,9 +312,17 @@ class Instruction extends Construction::TInstruction { /** * Gets the `Expr` whose results is computed by this instruction, if any. */ - final Expr getResultExpression() { - result = Construction::getInstructionResultExpression(this) + final Expr getConvertedResultExpression() { + result = Construction::getInstructionConvertedResultExpression(this) } + + /** + * Gets the `Expr` whose results is computed by this instruction, if any. + */ + final Expr getUnconvertedResultExpression() { + result = Construction::getInstructionUnconvertedResultExpression(this) + } + /** * Gets the type of the result produced by this instruction. If the diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll index f6e2034296d9..70af6ce64138 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/internal/SSAConstruction.qll @@ -197,8 +197,12 @@ cached private module Cached { ) } - cached Expr getInstructionResultExpression(Instruction instruction) { - result = getOldInstruction(instruction).getResultExpression() + cached Expr getInstructionConvertedResultExpression(Instruction instruction) { + result = getOldInstruction(instruction).getConvertedResultExpression() + } + + cached Expr getInstructionUnconvertedResultExpression(Instruction instruction) { + result = getOldInstruction(instruction).getUnconvertedResultExpression() } cached Instruction getInstructionSuccessor(Instruction instruction, EdgeKind kind) { diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll index a9a9d8190e67..b00c479139d8 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll @@ -312,9 +312,17 @@ class Instruction extends Construction::TInstruction { /** * Gets the `Expr` whose results is computed by this instruction, if any. */ - final Expr getResultExpression() { - result = Construction::getInstructionResultExpression(this) + final Expr getConvertedResultExpression() { + result = Construction::getInstructionConvertedResultExpression(this) } + + /** + * Gets the `Expr` whose results is computed by this instruction, if any. + */ + final Expr getUnconvertedResultExpression() { + result = Construction::getInstructionUnconvertedResultExpression(this) + } + /** * Gets the type of the result produced by this instruction. If the diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll index 306180e764ec..d8c14c0f9508 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/internal/IRConstruction.qll @@ -74,13 +74,25 @@ cached private module Cached { none() } - cached Expr getInstructionResultExpression(Instruction instruction) { + cached Expr getInstructionConvertedResultExpression(Instruction instruction) { exists(TranslatedExpr translatedExpr | translatedExpr = getTranslatedExpr(result) and instruction = translatedExpr.getResult() ) } + cached Expr getInstructionUnconvertedResultExpression(Instruction instruction) { + exists(Expr converted, TranslatedExpr translatedExpr | + result = converted.(Conversion).getExpr+() + or + result = converted + | + not result instanceof Conversion and + translatedExpr = getTranslatedExpr(converted) and + instruction = translatedExpr.getResult() + ) + } + cached Instruction getInstructionOperand(Instruction instruction, OperandTag tag) { result = getInstructionTranslatedElement(instruction).getInstructionOperand( instruction.getTag(), tag) diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll index a9a9d8190e67..b00c479139d8 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll @@ -312,9 +312,17 @@ class Instruction extends Construction::TInstruction { /** * Gets the `Expr` whose results is computed by this instruction, if any. */ - final Expr getResultExpression() { - result = Construction::getInstructionResultExpression(this) + final Expr getConvertedResultExpression() { + result = Construction::getInstructionConvertedResultExpression(this) } + + /** + * Gets the `Expr` whose results is computed by this instruction, if any. + */ + final Expr getUnconvertedResultExpression() { + result = Construction::getInstructionUnconvertedResultExpression(this) + } + /** * Gets the type of the result produced by this instruction. If the diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll index f6e2034296d9..70af6ce64138 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/SSAConstruction.qll @@ -197,8 +197,12 @@ cached private module Cached { ) } - cached Expr getInstructionResultExpression(Instruction instruction) { - result = getOldInstruction(instruction).getResultExpression() + cached Expr getInstructionConvertedResultExpression(Instruction instruction) { + result = getOldInstruction(instruction).getConvertedResultExpression() + } + + cached Expr getInstructionUnconvertedResultExpression(Instruction instruction) { + result = getOldInstruction(instruction).getUnconvertedResultExpression() } cached Instruction getInstructionSuccessor(Instruction instruction, EdgeKind kind) { From e2d24a27438150ea977474feb5fccead2cfa41e6 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Thu, 20 Sep 2018 13:07:36 -0700 Subject: [PATCH 13/33] C++: fix comment --- .../code/cpp/ir/implementation/aliased_ssa/Instruction.qll | 4 ++-- .../src/semmle/code/cpp/ir/implementation/raw/Instruction.qll | 4 ++-- .../code/cpp/ir/implementation/unaliased_ssa/Instruction.qll | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll index b00c479139d8..bf1837298138 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll @@ -310,14 +310,14 @@ class Instruction extends Construction::TInstruction { } /** - * Gets the `Expr` whose results is computed by this instruction, if any. + * Gets the `Expr` whose result is computed by this instruction, if any. */ final Expr getConvertedResultExpression() { result = Construction::getInstructionConvertedResultExpression(this) } /** - * Gets the `Expr` whose results is computed by this instruction, if any. + * Gets the unconverted `Expr` whose result is computed by this instruction, if any. */ final Expr getUnconvertedResultExpression() { result = Construction::getInstructionUnconvertedResultExpression(this) diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll index b00c479139d8..bf1837298138 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll @@ -310,14 +310,14 @@ class Instruction extends Construction::TInstruction { } /** - * Gets the `Expr` whose results is computed by this instruction, if any. + * Gets the `Expr` whose result is computed by this instruction, if any. */ final Expr getConvertedResultExpression() { result = Construction::getInstructionConvertedResultExpression(this) } /** - * Gets the `Expr` whose results is computed by this instruction, if any. + * Gets the unconverted `Expr` whose result is computed by this instruction, if any. */ final Expr getUnconvertedResultExpression() { result = Construction::getInstructionUnconvertedResultExpression(this) diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll index b00c479139d8..bf1837298138 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll @@ -310,14 +310,14 @@ class Instruction extends Construction::TInstruction { } /** - * Gets the `Expr` whose results is computed by this instruction, if any. + * Gets the `Expr` whose result is computed by this instruction, if any. */ final Expr getConvertedResultExpression() { result = Construction::getInstructionConvertedResultExpression(this) } /** - * Gets the `Expr` whose results is computed by this instruction, if any. + * Gets the unconverted `Expr` whose result is computed by this instruction, if any. */ final Expr getUnconvertedResultExpression() { result = Construction::getInstructionUnconvertedResultExpression(this) From 42fc28bc557e46dc077f57ccb8c915576d7c345a Mon Sep 17 00:00:00 2001 From: Esben Sparre Andreasen Date: Mon, 24 Sep 2018 11:17:35 +0200 Subject: [PATCH 14/33] JS: add ad hoc whitelist checks as sanitizers --- .../javascript/dataflow/TaintTracking.qll | 22 +++++++++++++++++++ .../TaintBarriers/SanitizingGuard.expected | 2 ++ .../TaintBarriers/TaintedSink.expected | 2 ++ .../TaintBarriers/isBarrier.expected | 2 ++ .../test/library-tests/TaintBarriers/tst.js | 13 +++++++++++ 5 files changed, 41 insertions(+) diff --git a/javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll b/javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll index 55f8ec8b9e7e..0c8abc2dba3c 100644 --- a/javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll +++ b/javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll @@ -625,6 +625,28 @@ module TaintTracking { } + /** + * A check of the form `if((x))`, which sanitizes `x` in its "then" branch. + * + * `` is a call with callee name 'safe', 'whitelist', 'allow', or similar. + */ + private class AdHocWhitelistCheckSanitizer extends AdditionalSanitizerGuardNode, DataFlow::CallNode { + AdHocWhitelistCheckSanitizer() { + getCalleeName().regexpMatch("(?i).*(safe|whitelist|allow|auth).*") and + getNumArgument() = 1 + } + + override predicate sanitizes(boolean outcome, Expr e) { + outcome = true and + e = getArgument(0).asExpr() + } + + override predicate appliesTo(Configuration cfg) { + any() + } + + } + /** A check of the form `if(x in o)`, which sanitizes `x` in its "then" branch. */ class InSanitizer extends AdditionalSanitizerGuardNode, DataFlow::ValueNode { diff --git a/javascript/ql/test/library-tests/TaintBarriers/SanitizingGuard.expected b/javascript/ql/test/library-tests/TaintBarriers/SanitizingGuard.expected index 28c823bbe2b1..ac750a13e3e3 100644 --- a/javascript/ql/test/library-tests/TaintBarriers/SanitizingGuard.expected +++ b/javascript/ql/test/library-tests/TaintBarriers/SanitizingGuard.expected @@ -36,3 +36,5 @@ | tst.js:214:9:214:24 | o.indexOf(v) < 0 | ExampleConfiguration | false | tst.js:214:19:214:19 | v | | tst.js:220:9:220:25 | o.indexOf(v) > -1 | ExampleConfiguration | true | tst.js:220:19:220:19 | v | | tst.js:226:9:226:26 | -1 >= o.indexOf(v) | ExampleConfiguration | false | tst.js:226:25:226:25 | v | +| tst.js:236:9:236:24 | isWhitelisted(v) | ExampleConfiguration | true | tst.js:236:23:236:23 | v | +| tst.js:240:9:240:28 | config.allowValue(v) | ExampleConfiguration | true | tst.js:240:27:240:27 | v | diff --git a/javascript/ql/test/library-tests/TaintBarriers/TaintedSink.expected b/javascript/ql/test/library-tests/TaintBarriers/TaintedSink.expected index 1831db03e3d0..81935683df3e 100644 --- a/javascript/ql/test/library-tests/TaintBarriers/TaintedSink.expected +++ b/javascript/ql/test/library-tests/TaintBarriers/TaintedSink.expected @@ -34,3 +34,5 @@ | tst.js:215:14:215:14 | v | tst.js:199:13:199:20 | SOURCE() | | tst.js:223:14:223:14 | v | tst.js:199:13:199:20 | SOURCE() | | tst.js:227:14:227:14 | v | tst.js:199:13:199:20 | SOURCE() | +| tst.js:239:14:239:14 | v | tst.js:235:13:235:20 | SOURCE() | +| tst.js:243:14:243:14 | v | tst.js:235:13:235:20 | SOURCE() | diff --git a/javascript/ql/test/library-tests/TaintBarriers/isBarrier.expected b/javascript/ql/test/library-tests/TaintBarriers/isBarrier.expected index 530c48093f79..315e118a0837 100644 --- a/javascript/ql/test/library-tests/TaintBarriers/isBarrier.expected +++ b/javascript/ql/test/library-tests/TaintBarriers/isBarrier.expected @@ -29,3 +29,5 @@ | tst.js:217:14:217:14 | v | ExampleConfiguration | | tst.js:221:14:221:14 | v | ExampleConfiguration | | tst.js:229:14:229:14 | v | ExampleConfiguration | +| tst.js:237:14:237:14 | v | ExampleConfiguration | +| tst.js:241:14:241:14 | v | ExampleConfiguration | diff --git a/javascript/ql/test/library-tests/TaintBarriers/tst.js b/javascript/ql/test/library-tests/TaintBarriers/tst.js index c0d7179a7a08..ea0cc0951759 100644 --- a/javascript/ql/test/library-tests/TaintBarriers/tst.js +++ b/javascript/ql/test/library-tests/TaintBarriers/tst.js @@ -230,3 +230,16 @@ function RelationalIndexOfCheckSanitizer () { } } + +function adhocWhitelisting() { + var v = SOURCE(); + if (isWhitelisted(v)) + SINK(v); + else + SINK(v); + if (config.allowValue(v)) + SINK(v); + else + SINK(v); + +} From ce11b5330d5dab3e3d8cc1d65d04e93e7d165ec6 Mon Sep 17 00:00:00 2001 From: Asger F Date: Fri, 21 Sep 2018 18:37:03 +0100 Subject: [PATCH 15/33] JS: recognize Express headers as RequestInputAccess --- .../ql/src/semmle/javascript/frameworks/Express.qll | 11 +++++++++++ .../frameworks/Express/RequestInputAccess.expected | 3 +++ .../library-tests/frameworks/Express/src/express.js | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/javascript/ql/src/semmle/javascript/frameworks/Express.qll b/javascript/ql/src/semmle/javascript/frameworks/Express.qll index c0163a143fe2..b2e1283e9073 100644 --- a/javascript/ql/src/semmle/javascript/frameworks/Express.qll +++ b/javascript/ql/src/semmle/javascript/frameworks/Express.qll @@ -479,6 +479,17 @@ module Express { methodName = "header" ) or + exists (DataFlow::PropRead headers | + // `req.headers.name` + kind = "header" and + headers.accesses(request, "headers") and + this = headers.getAPropertyRead(_)) + or + exists (string propName | propName = "host" or propName = "hostname" | + // `req.host` and `req.hostname` are derived from headers + kind = "header" and + this.(DataFlow::PropRead).accesses(request, propName)) + or // `req.cookies` kind = "cookie" and this.(DataFlow::PropRef).accesses(request, "cookies") diff --git a/javascript/ql/test/library-tests/frameworks/Express/RequestInputAccess.expected b/javascript/ql/test/library-tests/frameworks/Express/RequestInputAccess.expected index ebfd4b31eeb5..8f759c8a1d5c 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RequestInputAccess.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RequestInputAccess.expected @@ -12,3 +12,6 @@ | src/express.js:28:3:28:16 | req.get("foo") | header | src/express.js:22:30:32:1 | functio ... ar');\\n} | | src/express.js:29:3:29:19 | req.header("bar") | header | src/express.js:22:30:32:1 | functio ... ar');\\n} | | src/express.js:30:3:30:13 | req.cookies | cookie | src/express.js:22:30:32:1 | functio ... ar');\\n} | +| src/express.js:47:3:47:17 | req.headers.baz | header | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:48:3:48:10 | req.host | header | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:49:3:49:14 | req.hostname | header | src/express.js:46:22:50:1 | functio ... name;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/src/express.js b/javascript/ql/test/library-tests/frameworks/Express/src/express.js index ddbda24cd290..c3a96a3d6452 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/src/express.js +++ b/javascript/ql/test/library-tests/frameworks/Express/src/express.js @@ -42,3 +42,9 @@ function getArrowHandler() { return (req, res) => f(); } app.use(getArrowHandler()); + +app.post('/headers', function(req, res) { + req.headers.baz; + req.host; + req.hostname; +}); From e78a4e9f10b56f2ad771e7a5ce040bfca9bc9077 Mon Sep 17 00:00:00 2001 From: Asger F Date: Fri, 21 Sep 2018 18:37:26 +0100 Subject: [PATCH 16/33] JS: update output from other Express tests --- .../frameworks/Express/RequestExpr.expected | 3 +++ .../frameworks/Express/RouteHandler.expected | 1 + .../frameworks/Express/RouteHandlerExpr.expected | 1 + .../RouteHandlerExpr_getAMatchingAncestor.expected | 2 ++ .../frameworks/Express/RouteHandlerExpr_getBody.expected | 1 + .../Express/RouteHandlerExpr_getNextMiddleware.expected | 1 + .../RouteHandlerExpr_getPreviousMiddleware.expected | 1 + .../Express/RouteHandler_getARequestExpr.expected | 3 +++ .../library-tests/frameworks/Express/RouteSetup.expected | 1 + .../Express/RouteSetup_getARouteHandler.expected | 1 + .../Express/RouteSetup_getARouteHandlerExpr.expected | 1 + .../Express/RouteSetup_getLastRouteHandlerExpr.expected | 1 + .../Express/RouteSetup_getRequestMethod.expected | 1 + .../Express/RouteSetup_getRouteHandlerExpr.expected | 1 + .../frameworks/Express/RouteSetup_getRouter.expected | 1 + .../frameworks/Express/RouteSetup_getServer.expected | 1 + .../Express/RouterDefinition_getARouteHandler.expected | 1 + .../RouterDefinition_getMiddlewareStackAt.expected | 9 ++++++++- .../frameworks/Express/StandardRouteHandler.expected | 1 + .../library-tests/frameworks/Express/isRequest.expected | 3 +++ 20 files changed, 34 insertions(+), 1 deletion(-) diff --git a/javascript/ql/test/library-tests/frameworks/Express/RequestExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RequestExpr.expected index dab5febc8e86..8042100860d8 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RequestExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RequestExpr.expected @@ -14,4 +14,7 @@ | src/express.js:28:3:28:5 | req | src/express.js:22:30:32:1 | functio ... ar');\\n} | | src/express.js:29:3:29:5 | req | src/express.js:22:30:32:1 | functio ... ar');\\n} | | src/express.js:30:3:30:5 | req | src/express.js:22:30:32:1 | functio ... ar');\\n} | +| src/express.js:47:3:47:5 | req | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:48:3:48:5 | req | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:49:3:49:5 | req | src/express.js:46:22:50:1 | functio ... name;\\n} | | src/responseExprs.js:17:5:17:7 | req | src/responseExprs.js:16:30:42:1 | functio ... }\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandler.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandler.expected index 2751fe2b1618..16d1cfbe68dd 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandler.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandler.expected @@ -14,6 +14,7 @@ | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:22:39:22:41 | req | src/express.js:22:44:22:46 | res | | src/express.js:37:12:37:32 | functio ... res){} | src/express.js:37:22:37:24 | req | src/express.js:37:27:37:29 | res | | src/express.js:42:12:42:28 | (req, res) => f() | src/express.js:42:13:42:15 | req | src/express.js:42:18:42:20 | res | +| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:46:31:46:33 | req | src/express.js:46:36:46:38 | res | | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | src/responseExprs.js:4:32:4:34 | req | src/responseExprs.js:4:37:4:40 | res1 | | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | src/responseExprs.js:7:32:7:34 | req | src/responseExprs.js:7:37:7:40 | res2 | | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | src/responseExprs.js:10:39:10:41 | req | src/responseExprs.js:10:44:10:47 | res3 | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr.expected index aaf31f20eebd..ea23e2485942 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr.expected @@ -20,6 +20,7 @@ | src/express.js:34:14:34:52 | require ... handler | src/express.js:34:1:34:53 | app.get ... andler) | true | | src/express.js:39:9:39:20 | getHandler() | src/express.js:39:1:39:21 | app.use ... dler()) | false | | src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:44:1:44:26 | app.use ... dler()) | false | +| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | true | | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | true | | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | true | | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | true | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getAMatchingAncestor.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getAMatchingAncestor.expected index d66b0b4915a7..3f48873daa7b 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getAMatchingAncestor.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getAMatchingAncestor.expected @@ -16,3 +16,5 @@ | src/express.js:16:19:18:3 | functio ... ");\\n } | src/express.js:39:9:39:20 | getHandler() | | src/express.js:16:19:18:3 | functio ... ");\\n } | src/express.js:44:9:44:25 | getArrowHandler() | | src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:39:9:39:20 | getHandler() | +| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:39:9:39:20 | getHandler() | +| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:44:9:44:25 | getArrowHandler() | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getBody.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getBody.expected index 2a46b11b1d7e..2c79ac135a61 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getBody.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getBody.expected @@ -10,6 +10,7 @@ | src/express.js:4:23:9:1 | functio ... res);\\n} | src/express.js:4:23:9:1 | functio ... res);\\n} | | src/express.js:16:19:18:3 | functio ... ");\\n } | src/express.js:16:19:18:3 | functio ... ");\\n } | | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:22:30:32:1 | functio ... ar');\\n} | +| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:46:22:50:1 | functio ... name;\\n} | | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getNextMiddleware.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getNextMiddleware.expected index 893037fd8083..8aa06c0a8d6d 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getNextMiddleware.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getNextMiddleware.expected @@ -7,4 +7,5 @@ | src/csurf-example.js:18:9:18:30 | csrf({ ... true }) | src/csurf-example.js:40:27:40:48 | functio ... res) {} | | src/express.js:39:9:39:20 | getHandler() | src/express.js:44:9:44:25 | getArrowHandler() | | src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:16:19:18:3 | functio ... ");\\n } | +| src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:46:22:50:1 | functio ... name;\\n} | | src/subrouter.js:4:19:4:25 | protect | src/subrouter.js:5:14:5:28 | makeSubRouter() | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getPreviousMiddleware.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getPreviousMiddleware.expected index a58a2cfa0ddc..c1f2223bf3e8 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getPreviousMiddleware.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getPreviousMiddleware.expected @@ -7,4 +7,5 @@ | src/csurf-example.js:40:27:40:48 | functio ... res) {} | src/csurf-example.js:18:9:18:30 | csrf({ ... true }) | | src/express.js:16:19:18:3 | functio ... ");\\n } | src/express.js:44:9:44:25 | getArrowHandler() | | src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:39:9:39:20 | getHandler() | +| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:44:9:44:25 | getArrowHandler() | | src/subrouter.js:5:14:5:28 | makeSubRouter() | src/subrouter.js:4:19:4:25 | protect | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandler_getARequestExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandler_getARequestExpr.expected index f495f1c550a4..23d8c7ee264f 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandler_getARequestExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandler_getARequestExpr.expected @@ -14,4 +14,7 @@ | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:28:3:28:5 | req | | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:29:3:29:5 | req | | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:30:3:30:5 | req | +| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:47:3:47:5 | req | +| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:48:3:48:5 | req | +| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:49:3:49:5 | req | | src/responseExprs.js:16:30:42:1 | functio ... }\\n} | src/responseExprs.js:17:5:17:7 | req | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup.expected index 0489f326ba1f..e59183f81608 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup.expected @@ -9,6 +9,7 @@ | src/express.js:4:1:9:2 | app.get ... es);\\n}) | src/express.js:2:11:2:19 | express() | false | | src/express.js:16:3:18:4 | router. ... );\\n }) | src/express.js:2:11:2:19 | express() | false | | src/express.js:22:1:32:2 | app.pos ... r');\\n}) | src/express.js:2:11:2:19 | express() | false | +| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:2:11:2:19 | express() | false | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:2:11:2:19 | express() | false | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:2:11:2:19 | express() | false | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:2:11:2:19 | express() | false | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandler.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandler.expected index ce4218b05a86..4352f83b53c7 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandler.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandler.expected @@ -25,6 +25,7 @@ | src/express.js:39:1:39:21 | app.use ... dler()) | src/express.js:39:9:39:20 | getHandler() | | src/express.js:44:1:44:26 | app.use ... dler()) | src/express.js:42:12:42:28 | (req, res) => f() | | src/express.js:44:1:44:26 | app.use ... dler()) | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:46:22:50:1 | functio ... name;\\n} | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandlerExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandlerExpr.expected index 8f3eefb0ef42..d350d2943717 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandlerExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandlerExpr.expected @@ -20,6 +20,7 @@ | src/express.js:34:1:34:53 | app.get ... andler) | src/express.js:34:14:34:52 | require ... handler | | src/express.js:39:1:39:21 | app.use ... dler()) | src/express.js:39:9:39:20 | getHandler() | | src/express.js:44:1:44:26 | app.use ... dler()) | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:46:22:50:1 | functio ... name;\\n} | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getLastRouteHandlerExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getLastRouteHandlerExpr.expected index 8f3eefb0ef42..d350d2943717 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getLastRouteHandlerExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getLastRouteHandlerExpr.expected @@ -20,6 +20,7 @@ | src/express.js:34:1:34:53 | app.get ... andler) | src/express.js:34:14:34:52 | require ... handler | | src/express.js:39:1:39:21 | app.use ... dler()) | src/express.js:39:9:39:20 | getHandler() | | src/express.js:44:1:44:26 | app.use ... dler()) | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:46:22:50:1 | functio ... name;\\n} | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRequestMethod.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRequestMethod.expected index ff71b7d13f5e..be97e5c4a592 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRequestMethod.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRequestMethod.expected @@ -11,6 +11,7 @@ | src/express.js:16:3:18:4 | router. ... );\\n }) | GET | | src/express.js:22:1:32:2 | app.pos ... r');\\n}) | POST | | src/express.js:34:1:34:53 | app.get ... andler) | GET | +| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | POST | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | GET | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | GET | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | GET | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouteHandlerExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouteHandlerExpr.expected index 226a3d59d097..215340c51df3 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouteHandlerExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouteHandlerExpr.expected @@ -20,6 +20,7 @@ | src/express.js:34:1:34:53 | app.get ... andler) | 0 | src/express.js:34:14:34:52 | require ... handler | | src/express.js:39:1:39:21 | app.use ... dler()) | 0 | src/express.js:39:9:39:20 | getHandler() | | src/express.js:44:1:44:26 | app.use ... dler()) | 0 | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | 0 | src/express.js:46:22:50:1 | functio ... name;\\n} | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | 0 | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | 0 | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | 0 | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouter.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouter.expected index c29595cc07b9..dfeaa9922949 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouter.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouter.expected @@ -20,6 +20,7 @@ | src/express.js:34:1:34:53 | app.get ... andler) | src/express.js:2:11:2:19 | express() | | src/express.js:39:1:39:21 | app.use ... dler()) | src/express.js:2:11:2:19 | express() | | src/express.js:44:1:44:26 | app.use ... dler()) | src/express.js:2:11:2:19 | express() | +| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:2:11:2:19 | express() | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:2:11:2:19 | express() | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:2:11:2:19 | express() | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:2:11:2:19 | express() | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getServer.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getServer.expected index 68bcc0d9b677..23da8a6bdaa1 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getServer.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getServer.expected @@ -9,6 +9,7 @@ | src/express.js:4:1:9:2 | app.get ... es);\\n}) | src/express.js:2:11:2:19 | express() | | src/express.js:16:3:18:4 | router. ... );\\n }) | src/express.js:2:11:2:19 | express() | | src/express.js:22:1:32:2 | app.pos ... r');\\n}) | src/express.js:2:11:2:19 | express() | +| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:2:11:2:19 | express() | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:2:11:2:19 | express() | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:2:11:2:19 | express() | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:2:11:2:19 | express() | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getARouteHandler.expected b/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getARouteHandler.expected index 9ff5a646dd54..e10a8c517121 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getARouteHandler.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getARouteHandler.expected @@ -9,6 +9,7 @@ | src/express.js:2:11:2:19 | express() | src/express.js:4:23:9:1 | functio ... res);\\n} | | src/express.js:2:11:2:19 | express() | src/express.js:16:19:18:3 | functio ... ");\\n } | | src/express.js:2:11:2:19 | express() | src/express.js:22:30:32:1 | functio ... ar');\\n} | +| src/express.js:2:11:2:19 | express() | src/express.js:46:22:50:1 | functio ... name;\\n} | | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getMiddlewareStackAt.expected b/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getMiddlewareStackAt.expected index 232ca3a54f9d..0db82edd5d4c 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getMiddlewareStackAt.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getMiddlewareStackAt.expected @@ -75,7 +75,14 @@ | src/express.js:2:11:2:19 | express() | src/express.js:44:5:44:7 | use | src/express.js:39:9:39:20 | getHandler() | | src/express.js:2:11:2:19 | express() | src/express.js:44:9:44:23 | getArrowHandler | src/express.js:39:9:39:20 | getHandler() | | src/express.js:2:11:2:19 | express() | src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:39:9:39:20 | getHandler() | -| src/express.js:2:11:2:19 | express() | src/express.js:45:1:45:0 | exit node of | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:46:1:46:3 | app | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:46:1:46:8 | app.post | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:46:1:50:3 | app.pos ... me;\\n}); | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:46:5:46:8 | post | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:46:10:46:19 | '/headers' | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:51:1:51:0 | exit node of | src/express.js:44:9:44:25 | getArrowHandler() | | src/subrouter.js:2:11:2:19 | express() | src/subrouter.js:4:1:4:26 | app.use ... rotect) | src/subrouter.js:4:19:4:25 | protect | | src/subrouter.js:2:11:2:19 | express() | src/subrouter.js:5:1:5:3 | app | src/subrouter.js:4:19:4:25 | protect | | src/subrouter.js:2:11:2:19 | express() | src/subrouter.js:5:1:5:7 | app.use | src/subrouter.js:4:19:4:25 | protect | diff --git a/javascript/ql/test/library-tests/frameworks/Express/StandardRouteHandler.expected b/javascript/ql/test/library-tests/frameworks/Express/StandardRouteHandler.expected index e3cbcce77aaa..a6d30697915d 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/StandardRouteHandler.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/StandardRouteHandler.expected @@ -9,6 +9,7 @@ | src/express.js:4:23:9:1 | functio ... res);\\n} | src/express.js:2:11:2:19 | express() | src/express.js:4:32:4:34 | req | src/express.js:4:37:4:39 | res | | src/express.js:16:19:18:3 | functio ... ");\\n } | src/express.js:2:11:2:19 | express() | src/express.js:16:28:16:30 | req | src/express.js:16:33:16:35 | res | | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:2:11:2:19 | express() | src/express.js:22:39:22:41 | req | src/express.js:22:44:22:46 | res | +| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:2:11:2:19 | express() | src/express.js:46:31:46:33 | req | src/express.js:46:36:46:38 | res | | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:4:32:4:34 | req | src/responseExprs.js:4:37:4:40 | res1 | | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:7:32:7:34 | req | src/responseExprs.js:7:37:7:40 | res2 | | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:10:39:10:41 | req | src/responseExprs.js:10:44:10:47 | res3 | diff --git a/javascript/ql/test/library-tests/frameworks/Express/isRequest.expected b/javascript/ql/test/library-tests/frameworks/Express/isRequest.expected index 34e47ad1c92c..5b2915b2b384 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/isRequest.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/isRequest.expected @@ -14,4 +14,7 @@ | src/express.js:28:3:28:5 | req | | src/express.js:29:3:29:5 | req | | src/express.js:30:3:30:5 | req | +| src/express.js:47:3:47:5 | req | +| src/express.js:48:3:48:5 | req | +| src/express.js:49:3:49:5 | req | | src/responseExprs.js:17:5:17:7 | req | From 52061b35d84a3ffad997b3b308347a5c6865eef3 Mon Sep 17 00:00:00 2001 From: Esben Sparre Andreasen Date: Wed, 26 Sep 2018 09:20:07 +0200 Subject: [PATCH 17/33] JS: address review comments: improve regex, limit sanitizer usage --- .../src/semmle/javascript/dataflow/TaintTracking.qll | 10 ++++------ .../dataflow/CorsMisconfigurationForCredentials.qll | 5 +++++ .../TaintBarriers/ExampleConfiguration.qll | 5 +++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll b/javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll index 0c8abc2dba3c..05dfb29c4ad1 100644 --- a/javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll +++ b/javascript/ql/src/semmle/javascript/dataflow/TaintTracking.qll @@ -629,10 +629,12 @@ module TaintTracking { * A check of the form `if((x))`, which sanitizes `x` in its "then" branch. * * `` is a call with callee name 'safe', 'whitelist', 'allow', or similar. + * + * This sanitizer is not enabled by default. */ - private class AdHocWhitelistCheckSanitizer extends AdditionalSanitizerGuardNode, DataFlow::CallNode { + class AdHocWhitelistCheckSanitizer extends SanitizerGuardNode, DataFlow::CallNode { AdHocWhitelistCheckSanitizer() { - getCalleeName().regexpMatch("(?i).*(safe|whitelist|allow|auth).*") and + getCalleeName().regexpMatch("(?i).*((? Date: Wed, 26 Sep 2018 09:20:40 +0200 Subject: [PATCH 18/33] JS: change notes for AdHocWhitelistCheckSanitizer --- change-notes/1.19/analysis-javascript.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/change-notes/1.19/analysis-javascript.md b/change-notes/1.19/analysis-javascript.md index 4d23f695d9e0..8ddbf14b0873 100644 --- a/change-notes/1.19/analysis-javascript.md +++ b/change-notes/1.19/analysis-javascript.md @@ -4,6 +4,8 @@ * Modelling of taint flow through array operations has been improved. This may give additional results for the security queries. +* The taint tracking library now recognizes additional sanitization patterns. This may give fewer false-positive results for the security queries. + * Support for popular libraries has been improved. Consequently, queries may produce more results on code bases that use the following features: - file system access, for example through [fs-extra](https://github.com/jprichardson/node-fs-extra) or [globby](https://www.npmjs.com/package/globby) From a47b1dc774579e98bddecd5c5abb7fc28e06276f Mon Sep 17 00:00:00 2001 From: Asger F Date: Wed, 26 Sep 2018 08:22:21 +0100 Subject: [PATCH 19/33] JS: recognize Express header access with dynamic name --- javascript/ql/src/semmle/javascript/frameworks/Express.qll | 2 +- .../frameworks/Express/RequestInputAccess.expected | 7 ++++--- .../test/library-tests/frameworks/Express/src/express.js | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/javascript/ql/src/semmle/javascript/frameworks/Express.qll b/javascript/ql/src/semmle/javascript/frameworks/Express.qll index b2e1283e9073..03bdfbbf52f2 100644 --- a/javascript/ql/src/semmle/javascript/frameworks/Express.qll +++ b/javascript/ql/src/semmle/javascript/frameworks/Express.qll @@ -483,7 +483,7 @@ module Express { // `req.headers.name` kind = "header" and headers.accesses(request, "headers") and - this = headers.getAPropertyRead(_)) + this = headers.getAPropertyRead()) or exists (string propName | propName = "host" or propName = "hostname" | // `req.host` and `req.hostname` are derived from headers diff --git a/javascript/ql/test/library-tests/frameworks/Express/RequestInputAccess.expected b/javascript/ql/test/library-tests/frameworks/Express/RequestInputAccess.expected index 8f759c8a1d5c..8c0b0b3b76c3 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RequestInputAccess.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RequestInputAccess.expected @@ -12,6 +12,7 @@ | src/express.js:28:3:28:16 | req.get("foo") | header | src/express.js:22:30:32:1 | functio ... ar');\\n} | | src/express.js:29:3:29:19 | req.header("bar") | header | src/express.js:22:30:32:1 | functio ... ar');\\n} | | src/express.js:30:3:30:13 | req.cookies | cookie | src/express.js:22:30:32:1 | functio ... ar');\\n} | -| src/express.js:47:3:47:17 | req.headers.baz | header | src/express.js:46:22:50:1 | functio ... name;\\n} | -| src/express.js:48:3:48:10 | req.host | header | src/express.js:46:22:50:1 | functio ... name;\\n} | -| src/express.js:49:3:49:14 | req.hostname | header | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:47:3:47:17 | req.headers.baz | header | src/express.js:46:22:51:1 | functio ... ame];\\n} | +| src/express.js:48:3:48:10 | req.host | header | src/express.js:46:22:51:1 | functio ... ame];\\n} | +| src/express.js:49:3:49:14 | req.hostname | header | src/express.js:46:22:51:1 | functio ... ame];\\n} | +| src/express.js:50:3:50:32 | req.hea ... erName] | header | src/express.js:46:22:51:1 | functio ... ame];\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/src/express.js b/javascript/ql/test/library-tests/frameworks/Express/src/express.js index c3a96a3d6452..d60a18cde4fb 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/src/express.js +++ b/javascript/ql/test/library-tests/frameworks/Express/src/express.js @@ -47,4 +47,5 @@ app.post('/headers', function(req, res) { req.headers.baz; req.host; req.hostname; + req.headers[config.headerName]; }); From 057c3a92b4b04775741d8565acdf9747ee259730 Mon Sep 17 00:00:00 2001 From: Asger F Date: Wed, 26 Sep 2018 08:36:52 +0100 Subject: [PATCH 20/33] JS: update other Express test outputs --- .../library-tests/frameworks/Express/RequestExpr.expected | 7 ++++--- .../frameworks/Express/RouteHandler.expected | 2 +- .../frameworks/Express/RouteHandlerExpr.expected | 2 +- .../RouteHandlerExpr_getAMatchingAncestor.expected | 4 ++-- .../frameworks/Express/RouteHandlerExpr_getBody.expected | 2 +- .../Express/RouteHandlerExpr_getNextMiddleware.expected | 2 +- .../RouteHandlerExpr_getPreviousMiddleware.expected | 2 +- .../Express/RouteHandler_getARequestExpr.expected | 7 ++++--- .../library-tests/frameworks/Express/RouteSetup.expected | 2 +- .../Express/RouteSetup_getARouteHandler.expected | 2 +- .../Express/RouteSetup_getARouteHandlerExpr.expected | 2 +- .../Express/RouteSetup_getLastRouteHandlerExpr.expected | 2 +- .../Express/RouteSetup_getRequestMethod.expected | 2 +- .../Express/RouteSetup_getRouteHandlerExpr.expected | 2 +- .../frameworks/Express/RouteSetup_getRouter.expected | 2 +- .../frameworks/Express/RouteSetup_getServer.expected | 2 +- .../Express/RouterDefinition_getARouteHandler.expected | 2 +- .../RouterDefinition_getMiddlewareStackAt.expected | 8 ++++---- .../frameworks/Express/StandardRouteHandler.expected | 2 +- .../library-tests/frameworks/Express/isRequest.expected | 1 + 20 files changed, 30 insertions(+), 27 deletions(-) diff --git a/javascript/ql/test/library-tests/frameworks/Express/RequestExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RequestExpr.expected index 8042100860d8..6425c04ab80d 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RequestExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RequestExpr.expected @@ -14,7 +14,8 @@ | src/express.js:28:3:28:5 | req | src/express.js:22:30:32:1 | functio ... ar');\\n} | | src/express.js:29:3:29:5 | req | src/express.js:22:30:32:1 | functio ... ar');\\n} | | src/express.js:30:3:30:5 | req | src/express.js:22:30:32:1 | functio ... ar');\\n} | -| src/express.js:47:3:47:5 | req | src/express.js:46:22:50:1 | functio ... name;\\n} | -| src/express.js:48:3:48:5 | req | src/express.js:46:22:50:1 | functio ... name;\\n} | -| src/express.js:49:3:49:5 | req | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:47:3:47:5 | req | src/express.js:46:22:51:1 | functio ... ame];\\n} | +| src/express.js:48:3:48:5 | req | src/express.js:46:22:51:1 | functio ... ame];\\n} | +| src/express.js:49:3:49:5 | req | src/express.js:46:22:51:1 | functio ... ame];\\n} | +| src/express.js:50:3:50:5 | req | src/express.js:46:22:51:1 | functio ... ame];\\n} | | src/responseExprs.js:17:5:17:7 | req | src/responseExprs.js:16:30:42:1 | functio ... }\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandler.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandler.expected index 16d1cfbe68dd..babfdaa6bfa1 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandler.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandler.expected @@ -14,7 +14,7 @@ | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:22:39:22:41 | req | src/express.js:22:44:22:46 | res | | src/express.js:37:12:37:32 | functio ... res){} | src/express.js:37:22:37:24 | req | src/express.js:37:27:37:29 | res | | src/express.js:42:12:42:28 | (req, res) => f() | src/express.js:42:13:42:15 | req | src/express.js:42:18:42:20 | res | -| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:46:31:46:33 | req | src/express.js:46:36:46:38 | res | +| src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:46:31:46:33 | req | src/express.js:46:36:46:38 | res | | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | src/responseExprs.js:4:32:4:34 | req | src/responseExprs.js:4:37:4:40 | res1 | | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | src/responseExprs.js:7:32:7:34 | req | src/responseExprs.js:7:37:7:40 | res2 | | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | src/responseExprs.js:10:39:10:41 | req | src/responseExprs.js:10:44:10:47 | res3 | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr.expected index ea23e2485942..e288c556b8c4 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr.expected @@ -20,7 +20,7 @@ | src/express.js:34:14:34:52 | require ... handler | src/express.js:34:1:34:53 | app.get ... andler) | true | | src/express.js:39:9:39:20 | getHandler() | src/express.js:39:1:39:21 | app.use ... dler()) | false | | src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:44:1:44:26 | app.use ... dler()) | false | -| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | true | +| src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:46:1:51:2 | app.pos ... me];\\n}) | true | | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | true | | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | true | | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | true | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getAMatchingAncestor.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getAMatchingAncestor.expected index 3f48873daa7b..e4bd32539d9a 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getAMatchingAncestor.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getAMatchingAncestor.expected @@ -16,5 +16,5 @@ | src/express.js:16:19:18:3 | functio ... ");\\n } | src/express.js:39:9:39:20 | getHandler() | | src/express.js:16:19:18:3 | functio ... ");\\n } | src/express.js:44:9:44:25 | getArrowHandler() | | src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:39:9:39:20 | getHandler() | -| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:39:9:39:20 | getHandler() | -| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:39:9:39:20 | getHandler() | +| src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:44:9:44:25 | getArrowHandler() | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getBody.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getBody.expected index 2c79ac135a61..f4805a5e53e6 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getBody.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getBody.expected @@ -10,7 +10,7 @@ | src/express.js:4:23:9:1 | functio ... res);\\n} | src/express.js:4:23:9:1 | functio ... res);\\n} | | src/express.js:16:19:18:3 | functio ... ");\\n } | src/express.js:16:19:18:3 | functio ... ");\\n } | | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:22:30:32:1 | functio ... ar');\\n} | -| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:46:22:51:1 | functio ... ame];\\n} | | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getNextMiddleware.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getNextMiddleware.expected index 8aa06c0a8d6d..b7081b75823f 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getNextMiddleware.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getNextMiddleware.expected @@ -7,5 +7,5 @@ | src/csurf-example.js:18:9:18:30 | csrf({ ... true }) | src/csurf-example.js:40:27:40:48 | functio ... res) {} | | src/express.js:39:9:39:20 | getHandler() | src/express.js:44:9:44:25 | getArrowHandler() | | src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:16:19:18:3 | functio ... ");\\n } | -| src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:46:22:51:1 | functio ... ame];\\n} | | src/subrouter.js:4:19:4:25 | protect | src/subrouter.js:5:14:5:28 | makeSubRouter() | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getPreviousMiddleware.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getPreviousMiddleware.expected index c1f2223bf3e8..63f85929c59c 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getPreviousMiddleware.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandlerExpr_getPreviousMiddleware.expected @@ -7,5 +7,5 @@ | src/csurf-example.js:40:27:40:48 | functio ... res) {} | src/csurf-example.js:18:9:18:30 | csrf({ ... true }) | | src/express.js:16:19:18:3 | functio ... ");\\n } | src/express.js:44:9:44:25 | getArrowHandler() | | src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:39:9:39:20 | getHandler() | -| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:44:9:44:25 | getArrowHandler() | | src/subrouter.js:5:14:5:28 | makeSubRouter() | src/subrouter.js:4:19:4:25 | protect | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteHandler_getARequestExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteHandler_getARequestExpr.expected index 23d8c7ee264f..732a9e8391e2 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteHandler_getARequestExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteHandler_getARequestExpr.expected @@ -14,7 +14,8 @@ | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:28:3:28:5 | req | | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:29:3:29:5 | req | | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:30:3:30:5 | req | -| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:47:3:47:5 | req | -| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:48:3:48:5 | req | -| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:49:3:49:5 | req | +| src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:47:3:47:5 | req | +| src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:48:3:48:5 | req | +| src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:49:3:49:5 | req | +| src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:50:3:50:5 | req | | src/responseExprs.js:16:30:42:1 | functio ... }\\n} | src/responseExprs.js:17:5:17:7 | req | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup.expected index e59183f81608..8112a1636a96 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup.expected @@ -9,7 +9,7 @@ | src/express.js:4:1:9:2 | app.get ... es);\\n}) | src/express.js:2:11:2:19 | express() | false | | src/express.js:16:3:18:4 | router. ... );\\n }) | src/express.js:2:11:2:19 | express() | false | | src/express.js:22:1:32:2 | app.pos ... r');\\n}) | src/express.js:2:11:2:19 | express() | false | -| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:2:11:2:19 | express() | false | +| src/express.js:46:1:51:2 | app.pos ... me];\\n}) | src/express.js:2:11:2:19 | express() | false | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:2:11:2:19 | express() | false | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:2:11:2:19 | express() | false | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:2:11:2:19 | express() | false | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandler.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandler.expected index 4352f83b53c7..7ed8331c31de 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandler.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandler.expected @@ -25,7 +25,7 @@ | src/express.js:39:1:39:21 | app.use ... dler()) | src/express.js:39:9:39:20 | getHandler() | | src/express.js:44:1:44:26 | app.use ... dler()) | src/express.js:42:12:42:28 | (req, res) => f() | | src/express.js:44:1:44:26 | app.use ... dler()) | src/express.js:44:9:44:25 | getArrowHandler() | -| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:46:1:51:2 | app.pos ... me];\\n}) | src/express.js:46:22:51:1 | functio ... ame];\\n} | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandlerExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandlerExpr.expected index d350d2943717..e788350ad5f2 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandlerExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getARouteHandlerExpr.expected @@ -20,7 +20,7 @@ | src/express.js:34:1:34:53 | app.get ... andler) | src/express.js:34:14:34:52 | require ... handler | | src/express.js:39:1:39:21 | app.use ... dler()) | src/express.js:39:9:39:20 | getHandler() | | src/express.js:44:1:44:26 | app.use ... dler()) | src/express.js:44:9:44:25 | getArrowHandler() | -| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:46:1:51:2 | app.pos ... me];\\n}) | src/express.js:46:22:51:1 | functio ... ame];\\n} | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getLastRouteHandlerExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getLastRouteHandlerExpr.expected index d350d2943717..e788350ad5f2 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getLastRouteHandlerExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getLastRouteHandlerExpr.expected @@ -20,7 +20,7 @@ | src/express.js:34:1:34:53 | app.get ... andler) | src/express.js:34:14:34:52 | require ... handler | | src/express.js:39:1:39:21 | app.use ... dler()) | src/express.js:39:9:39:20 | getHandler() | | src/express.js:44:1:44:26 | app.use ... dler()) | src/express.js:44:9:44:25 | getArrowHandler() | -| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:46:1:51:2 | app.pos ... me];\\n}) | src/express.js:46:22:51:1 | functio ... ame];\\n} | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRequestMethod.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRequestMethod.expected index be97e5c4a592..ef656f126633 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRequestMethod.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRequestMethod.expected @@ -11,7 +11,7 @@ | src/express.js:16:3:18:4 | router. ... );\\n }) | GET | | src/express.js:22:1:32:2 | app.pos ... r');\\n}) | POST | | src/express.js:34:1:34:53 | app.get ... andler) | GET | -| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | POST | +| src/express.js:46:1:51:2 | app.pos ... me];\\n}) | POST | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | GET | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | GET | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | GET | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouteHandlerExpr.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouteHandlerExpr.expected index 215340c51df3..61ae5da20308 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouteHandlerExpr.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouteHandlerExpr.expected @@ -20,7 +20,7 @@ | src/express.js:34:1:34:53 | app.get ... andler) | 0 | src/express.js:34:14:34:52 | require ... handler | | src/express.js:39:1:39:21 | app.use ... dler()) | 0 | src/express.js:39:9:39:20 | getHandler() | | src/express.js:44:1:44:26 | app.use ... dler()) | 0 | src/express.js:44:9:44:25 | getArrowHandler() | -| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | 0 | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:46:1:51:2 | app.pos ... me];\\n}) | 0 | src/express.js:46:22:51:1 | functio ... ame];\\n} | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | 0 | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | 0 | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | 0 | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouter.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouter.expected index dfeaa9922949..46af44628f11 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouter.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getRouter.expected @@ -20,7 +20,7 @@ | src/express.js:34:1:34:53 | app.get ... andler) | src/express.js:2:11:2:19 | express() | | src/express.js:39:1:39:21 | app.use ... dler()) | src/express.js:2:11:2:19 | express() | | src/express.js:44:1:44:26 | app.use ... dler()) | src/express.js:2:11:2:19 | express() | -| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:2:11:2:19 | express() | +| src/express.js:46:1:51:2 | app.pos ... me];\\n}) | src/express.js:2:11:2:19 | express() | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:2:11:2:19 | express() | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:2:11:2:19 | express() | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:2:11:2:19 | express() | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getServer.expected b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getServer.expected index 23da8a6bdaa1..a37c24eeeda3 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getServer.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouteSetup_getServer.expected @@ -9,7 +9,7 @@ | src/express.js:4:1:9:2 | app.get ... es);\\n}) | src/express.js:2:11:2:19 | express() | | src/express.js:16:3:18:4 | router. ... );\\n }) | src/express.js:2:11:2:19 | express() | | src/express.js:22:1:32:2 | app.pos ... r');\\n}) | src/express.js:2:11:2:19 | express() | -| src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:2:11:2:19 | express() | +| src/express.js:46:1:51:2 | app.pos ... me];\\n}) | src/express.js:2:11:2:19 | express() | | src/responseExprs.js:4:1:6:2 | app.get ... res1\\n}) | src/responseExprs.js:2:11:2:19 | express() | | src/responseExprs.js:7:1:9:2 | app.get ... es2;\\n}) | src/responseExprs.js:2:11:2:19 | express() | | src/responseExprs.js:10:1:12:2 | app.get ... es3;\\n}) | src/responseExprs.js:2:11:2:19 | express() | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getARouteHandler.expected b/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getARouteHandler.expected index e10a8c517121..7a37c4c671e5 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getARouteHandler.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getARouteHandler.expected @@ -9,7 +9,7 @@ | src/express.js:2:11:2:19 | express() | src/express.js:4:23:9:1 | functio ... res);\\n} | | src/express.js:2:11:2:19 | express() | src/express.js:16:19:18:3 | functio ... ");\\n } | | src/express.js:2:11:2:19 | express() | src/express.js:22:30:32:1 | functio ... ar');\\n} | -| src/express.js:2:11:2:19 | express() | src/express.js:46:22:50:1 | functio ... name;\\n} | +| src/express.js:2:11:2:19 | express() | src/express.js:46:22:51:1 | functio ... ame];\\n} | | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | diff --git a/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getMiddlewareStackAt.expected b/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getMiddlewareStackAt.expected index 0db82edd5d4c..fd3766cb7b38 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getMiddlewareStackAt.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/RouterDefinition_getMiddlewareStackAt.expected @@ -77,12 +77,12 @@ | src/express.js:2:11:2:19 | express() | src/express.js:44:9:44:25 | getArrowHandler() | src/express.js:39:9:39:20 | getHandler() | | src/express.js:2:11:2:19 | express() | src/express.js:46:1:46:3 | app | src/express.js:44:9:44:25 | getArrowHandler() | | src/express.js:2:11:2:19 | express() | src/express.js:46:1:46:8 | app.post | src/express.js:44:9:44:25 | getArrowHandler() | -| src/express.js:2:11:2:19 | express() | src/express.js:46:1:50:2 | app.pos ... ame;\\n}) | src/express.js:44:9:44:25 | getArrowHandler() | -| src/express.js:2:11:2:19 | express() | src/express.js:46:1:50:3 | app.pos ... me;\\n}); | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:46:1:51:2 | app.pos ... me];\\n}) | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:46:1:51:3 | app.pos ... e];\\n}); | src/express.js:44:9:44:25 | getArrowHandler() | | src/express.js:2:11:2:19 | express() | src/express.js:46:5:46:8 | post | src/express.js:44:9:44:25 | getArrowHandler() | | src/express.js:2:11:2:19 | express() | src/express.js:46:10:46:19 | '/headers' | src/express.js:44:9:44:25 | getArrowHandler() | -| src/express.js:2:11:2:19 | express() | src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:44:9:44:25 | getArrowHandler() | -| src/express.js:2:11:2:19 | express() | src/express.js:51:1:51:0 | exit node of | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:44:9:44:25 | getArrowHandler() | +| src/express.js:2:11:2:19 | express() | src/express.js:52:1:52:0 | exit node of | src/express.js:44:9:44:25 | getArrowHandler() | | src/subrouter.js:2:11:2:19 | express() | src/subrouter.js:4:1:4:26 | app.use ... rotect) | src/subrouter.js:4:19:4:25 | protect | | src/subrouter.js:2:11:2:19 | express() | src/subrouter.js:5:1:5:3 | app | src/subrouter.js:4:19:4:25 | protect | | src/subrouter.js:2:11:2:19 | express() | src/subrouter.js:5:1:5:7 | app.use | src/subrouter.js:4:19:4:25 | protect | diff --git a/javascript/ql/test/library-tests/frameworks/Express/StandardRouteHandler.expected b/javascript/ql/test/library-tests/frameworks/Express/StandardRouteHandler.expected index a6d30697915d..dfd0a7058130 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/StandardRouteHandler.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/StandardRouteHandler.expected @@ -9,7 +9,7 @@ | src/express.js:4:23:9:1 | functio ... res);\\n} | src/express.js:2:11:2:19 | express() | src/express.js:4:32:4:34 | req | src/express.js:4:37:4:39 | res | | src/express.js:16:19:18:3 | functio ... ");\\n } | src/express.js:2:11:2:19 | express() | src/express.js:16:28:16:30 | req | src/express.js:16:33:16:35 | res | | src/express.js:22:30:32:1 | functio ... ar');\\n} | src/express.js:2:11:2:19 | express() | src/express.js:22:39:22:41 | req | src/express.js:22:44:22:46 | res | -| src/express.js:46:22:50:1 | functio ... name;\\n} | src/express.js:2:11:2:19 | express() | src/express.js:46:31:46:33 | req | src/express.js:46:36:46:38 | res | +| src/express.js:46:22:51:1 | functio ... ame];\\n} | src/express.js:2:11:2:19 | express() | src/express.js:46:31:46:33 | req | src/express.js:46:36:46:38 | res | | src/responseExprs.js:4:23:6:1 | functio ... res1\\n} | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:4:32:4:34 | req | src/responseExprs.js:4:37:4:40 | res1 | | src/responseExprs.js:7:23:9:1 | functio ... res2;\\n} | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:7:32:7:34 | req | src/responseExprs.js:7:37:7:40 | res2 | | src/responseExprs.js:10:23:12:1 | functio ... res3;\\n} | src/responseExprs.js:2:11:2:19 | express() | src/responseExprs.js:10:39:10:41 | req | src/responseExprs.js:10:44:10:47 | res3 | diff --git a/javascript/ql/test/library-tests/frameworks/Express/isRequest.expected b/javascript/ql/test/library-tests/frameworks/Express/isRequest.expected index 5b2915b2b384..d36af77ff644 100644 --- a/javascript/ql/test/library-tests/frameworks/Express/isRequest.expected +++ b/javascript/ql/test/library-tests/frameworks/Express/isRequest.expected @@ -17,4 +17,5 @@ | src/express.js:47:3:47:5 | req | | src/express.js:48:3:48:5 | req | | src/express.js:49:3:49:5 | req | +| src/express.js:50:3:50:5 | req | | src/responseExprs.js:17:5:17:7 | req | From e2ccd57bdda7226ac678d40a217805da9dbd7e4c Mon Sep 17 00:00:00 2001 From: Jonas Jensen Date: Wed, 26 Sep 2018 15:07:40 +0200 Subject: [PATCH 21/33] .gitignore everything under .vs in repo root dir We have external users editing queries with Visual Studio, and it seems to automatically add very specific files to `.gitignore`. These changes cause conflicts between unrelated PRs. This commit adds all of `/.vs` to `.gitignore`, which should hopfully make Visual Studio stop adding more entries. --- .gitignore | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 7e82b2f488ca..6cf1596143db 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # editor and OS artifacts *~ +/.vs .DS_STORE # query compilation caches @@ -8,8 +9,3 @@ # qltest projects and artifacts */ql/test/**/*.testproj */ql/test/**/*.actual -/.vs/slnx.sqlite -/.vs/ql/v15/Browse.VC.opendb -/.vs/ql/v15/Browse.VC.db -/.vs/ProjectSettings.json - From 26c1397216a17b7ec3e3c4940a6cc184c6ca5a26 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Wed, 26 Sep 2018 15:13:50 +0200 Subject: [PATCH 22/33] CPP/CSharp/Javascript: Clean up QLDoc and bring the different XML.qll files closer. --- cpp/ql/src/semmle/code/cpp/XML.qll | 122 ++++++++++---------- csharp/ql/src/semmle/code/csharp/XML.qll | 119 ++++++++++--------- javascript/ql/src/semmle/javascript/XML.qll | 98 ++++++++-------- 3 files changed, 169 insertions(+), 170 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/XML.qll b/cpp/ql/src/semmle/code/cpp/XML.qll index b3f4cc420a0a..e1cb3abaa92e 100644 --- a/cpp/ql/src/semmle/code/cpp/XML.qll +++ b/cpp/ql/src/semmle/code/cpp/XML.qll @@ -1,16 +1,16 @@ /** - * A library for working with XML files and their content. + * Provides classes and predicates for working with XML files and their content. */ import semmle.code.cpp.Location /** An XML element that has a location. */ abstract class XMLLocatable extends @xmllocatable { - /** The source location for this element. */ + /** Gets the source location for this element. */ Location getLocation() { xmllocations(this,result) } /** - * Whether this element has the specified location information, + * Holds if this element has the specified location information, * including file path, start line, start column, end line and end column. */ predicate hasLocationInfo(string filepath, int startline, int startcolumn, int endline, int endcolumn) { @@ -20,7 +20,7 @@ abstract class XMLLocatable extends @xmllocatable { ) } - /** A printable representation of this element. */ + /** Gets a printable representation of this element. */ abstract string toString(); } @@ -30,38 +30,38 @@ abstract class XMLLocatable extends @xmllocatable { */ class XMLParent extends @xmlparent { /** - * A printable representation of this XML parent. + * Gets a printable representation of this XML parent. * (Intended to be overridden in subclasses.) */ abstract string getName(); - /** The file to which this XML parent belongs. */ + /** Gets the file to which this XML parent belongs. */ XMLFile getFile() { result = this or xmlElements(this,_,_,_,result) } - /** The child element at a specified index of this XML parent. */ + /** Gets the child element at a specified index of this XML parent. */ XMLElement getChild(int index) { xmlElements(result, _, this, index, _) } - /** A child element of this XML parent. */ + /** Gets a child element of this XML parent. */ XMLElement getAChild() { xmlElements(result,_,this,_,_) } - /** A child element of this XML parent with the given `name`. */ + /** Gets a child element of this XML parent with the given `name`. */ XMLElement getAChild(string name) { xmlElements(result,_,this,_,_) and result.hasName(name) } - /** A comment that is a child of this XML parent. */ + /** Gets a comment that is a child of this XML parent. */ XMLComment getAComment() { xmlComments(result,_,this,_) } - /** A character sequence that is a child of this XML parent. */ + /** Gets a character sequence that is a child of this XML parent. */ XMLCharacters getACharactersSet() { xmlChars(result,_,this,_,_,_) } - /** The depth in the tree. (Overridden in XMLElement.) */ + /** Gets the depth in the tree. (Overridden in XMLElement.) */ int getDepth() { result = 0 } - /** The number of child XML elements of this XML parent. */ + /** Gets the number of child XML elements of this XML parent. */ int getNumberOfChildren() { result = count(XMLElement e | xmlElements(e,_,this,_,_)) } - /** The number of places in the body of this XML parent where text occurs. */ + /** Gets the number of places in the body of this XML parent where text occurs. */ int getNumberOfCharacterSets() { result = count(int pos | xmlChars(_,_,this,pos,_,_)) } @@ -84,12 +84,12 @@ class XMLParent extends @xmlparent { ) } - /** The text value contained in this XML parent. */ + /** Gets the text value contained in this XML parent. */ string getTextValue() { result = allCharactersString() } - /** A printable representation of this XML parent. */ + /** Gets a printable representation of this XML parent. */ string toString() { result = this.getName() } } @@ -99,54 +99,54 @@ class XMLFile extends XMLParent, File { xmlEncoding(this,_) } - /** A printable representation of this XML file. */ + /** Gets a printable representation of this XML file. */ override string toString() { result = XMLParent.super.toString() } - /** The name of this XML file. */ + /** Gets the name of this XML file. */ override string getName() { files(this,result,_,_,_) } - /** The path of this XML file. */ + /** Gets the path of this XML file. */ string getPath() { files(this,_,result,_,_) } - /** The path of the folder that contains this XML file. */ + /** Gets the path of the folder that contains this XML file. */ string getFolder() { result = this.getPath().substring(0, this.getPath().length()-this.getName().length()) } - /** The encoding of this XML file. */ + /** Gets the encoding of this XML file. */ string getEncoding() { xmlEncoding(this,result) } - /** The XML file itself. */ + /** Gets the XML file itself. */ override XMLFile getFile() { result = this } - /** A top-most element in an XML file. */ + /** Gets a top-most element in an XML file. */ XMLElement getARootElement() { result = this.getAChild() } - /** A DTD associated with this XML file. */ + /** Gets a DTD associated with this XML file. */ XMLDTD getADTD() { xmlDTDs(result,_,_,_,this) } } /** A "Document Type Definition" of an XML file. */ class XMLDTD extends @xmldtd { - /** The name of the root element of this DTD. */ + /** Gets the name of the root element of this DTD. */ string getRoot() { xmlDTDs(this,result,_,_,_) } - /** The public ID of this DTD. */ + /** Gets the public ID of this DTD. */ string getPublicId() { xmlDTDs(this,_,result,_,_) } - /** The system ID of this DTD. */ + /** Gets the system ID of this DTD. */ string getSystemId() { xmlDTDs(this,_,_,result,_) } - /** Whether this DTD is public. */ + /** Holds if this DTD is public. */ predicate isPublic() { not xmlDTDs(this,_,"",_,_) } - /** The parent of this DTD. */ + /** Gets the parent of this DTD. */ XMLParent getParent() { xmlDTDs(this,_,_,_,result) } - /** A printable representation of this DTD. */ + /** Gets a printable representation of this DTD. */ string toString() { (this.isPublic() and result = this.getRoot() + " PUBLIC '" + this.getPublicId() + "' '" + @@ -159,92 +159,92 @@ class XMLDTD extends @xmldtd { /** An XML tag in an XML file. */ class XMLElement extends @xmlelement, XMLParent, XMLLocatable { - /** Whether this XML element has the given `name`. */ + /** Holds if this XML element has the given `name`. */ predicate hasName(string name) { name = getName() } - /** The name of this XML element. */ + /** Gets the name of this XML element. */ override string getName() { xmlElements(this,result,_,_,_) } - /** The XML file in which this XML element occurs. */ + /** Gets the XML file in which this XML element occurs. */ override XMLFile getFile() { xmlElements(this,_,_,_,result) } - /** The parent of this XML element. */ + /** Gets the parent of this XML element. */ XMLParent getParent() { xmlElements(this,_,result,_,_) } - /** The index of this XML element among its parent's children. */ + /** Gets the index of this XML element among its parent's children. */ int getIndex() { xmlElements(this, _, _, result, _) } - /** Whether this XML element has a namespace. */ + /** Holds if this XML element has a namespace. */ predicate hasNamespace() { xmlHasNs(this,_,_) } - /** The namespace of this XML element, if any. */ + /** Gets the namespace of this XML element, if any. */ XMLNamespace getNamespace() { xmlHasNs(this,result,_) } - /** The index of this XML element among its parent's children. */ + /** Gets the index of this XML element among its parent's children. */ int getElementPositionIndex() { xmlElements(this,_,_,result,_) } - /** The depth of this element within the XML file tree structure. */ + /** Gets the depth of this element within the XML file tree structure. */ override int getDepth() { result = this.getParent().getDepth() + 1 } - /** An XML attribute of this XML element. */ + /** Gets an XML attribute of this XML element. */ XMLAttribute getAnAttribute() { result.getElement() = this } - /** The attribute with the specified `name`, if any. */ + /** Gets the attribute with the specified `name`, if any. */ XMLAttribute getAttribute(string name) { result.getElement() = this and result.getName() = name } - /** Whether this XML element has an attribute with the specified `name`. */ + /** Holds if this XML element has an attribute with the specified `name`. */ predicate hasAttribute(string name) { exists(XMLAttribute a| a = this.getAttribute(name)) } - /** The value of the attribute with the specified `name`, if any. */ + /** Gets the value of the attribute with the specified `name`, if any. */ string getAttributeValue(string name) { result = this.getAttribute(name).getValue() } - /** A printable representation of this XML element. */ + /** Gets a printable representation of this XML element. */ override string toString() { result = XMLParent.super.toString() } } /** An attribute that occurs inside an XML element. */ class XMLAttribute extends @xmlattribute, XMLLocatable { - /** The name of this attribute. */ + /** Gets the name of this attribute. */ string getName() { xmlAttrs(this,_,result,_,_,_) } - /** The XML element to which this attribute belongs. */ + /** Gets the XML element to which this attribute belongs. */ XMLElement getElement() { xmlAttrs(this,result,_,_,_,_) } - /** Whether this attribute has a namespace. */ + /** Holds if this attribute has a namespace. */ predicate hasNamespace() { xmlHasNs(this,_,_) } - /** The namespace of this attribute, if any. */ + /** Gets the namespace of this attribute, if any. */ XMLNamespace getNamespace() { xmlHasNs(this,result,_) } - /** The value of this attribute. */ + /** Gets the value of this attribute. */ string getValue() { xmlAttrs(this,_,_,result,_,_) } - /** A printable representation of this XML attribute. */ + /** Gets a printable representation of this XML attribute. */ override string toString() { result = this.getName() + "=" + this.getValue() } } /** A namespace used in an XML file */ class XMLNamespace extends @xmlnamespace { - /** The prefix of this namespace. */ + /** Gets the prefix of this namespace. */ string getPrefix() { xmlNs(this,result,_,_) } - /** The URI of this namespace. */ + /** Gets the URI of this namespace. */ string getURI() { xmlNs(this,_,result,_) } - /** Whether this namespace has no prefix. */ + /** Holds if this namespace has no prefix. */ predicate isDefault() { this.getPrefix() = "" } - /** A printable representation of this XML namespace. */ + /** Gets a printable representation of this XML namespace. */ string toString() { (this.isDefault() and result = this.getURI()) or (not this.isDefault() and result = this.getPrefix() + ":" + this.getURI()) @@ -253,13 +253,13 @@ class XMLNamespace extends @xmlnamespace { /** A comment of the form `` is an XML comment. */ class XMLComment extends @xmlcomment, XMLLocatable { - /** The text content of this XML comment. */ + /** Gets the text content of this XML comment. */ string getText() { xmlComments(this,result,_,_) } - /** The parent of this XML comment. */ + /** Gets the parent of this XML comment. */ XMLParent getParent() { xmlComments(this,_,result,_) } - /** A printable representation of this XML comment. */ + /** Gets a printable representation of this XML comment. */ override string toString() { result = this.getText() } } @@ -268,15 +268,15 @@ class XMLComment extends @xmlcomment, XMLLocatable { * closing tags of an XML element, excluding other elements. */ class XMLCharacters extends @xmlcharacters, XMLLocatable { - /** The content of this character sequence. */ + /** Gets the content of this character sequence. */ string getCharacters() { xmlChars(this,result,_,_,_,_) } - /** The parent of this character sequence. */ + /** Gets the parent of this character sequence. */ XMLParent getParent() { xmlChars(this,_,result,_,_,_) } - /** Whether this character sequence is CDATA. */ + /** Holds if this character sequence is CDATA. */ predicate isCDATA() { xmlChars(this,_,_,_,1,_) } - /** A printable representation of this XML character sequence. */ + /** Gets a printable representation of this XML character sequence. */ override string toString() { result = this.getCharacters() } } diff --git a/csharp/ql/src/semmle/code/csharp/XML.qll b/csharp/ql/src/semmle/code/csharp/XML.qll index 8b605b02508f..1d3206264832 100644 --- a/csharp/ql/src/semmle/code/csharp/XML.qll +++ b/csharp/ql/src/semmle/code/csharp/XML.qll @@ -1,5 +1,5 @@ /** - * A library for working with XML files and their content. + * Provides classes and predicates for working with XML files and their content. */ import semmle.code.csharp.Element @@ -18,7 +18,7 @@ class XMLLocatable extends @xmllocatable { not this instanceof File // in the dbscheme } - /** The source location for this element. */ + /** Gets the source location for this element. */ Location getALocation() { xmllocations(this,result) } /** @@ -32,7 +32,7 @@ class XMLLocatable extends @xmllocatable { ) } - /** A printable representation of this element. */ + /** Gets a printable representation of this element. */ abstract string toString(); } @@ -42,38 +42,38 @@ class XMLLocatable extends @xmllocatable { */ class XMLParent extends @xmlparent { /** - * A printable representation of this XML parent. + * Gets a printable representation of this XML parent. * (Intended to be overridden in subclasses.) */ abstract string getName(); - /** The file to which this XML parent belongs. */ + /** Gets the file to which this XML parent belongs. */ XMLFile getFile() { result = this or xmlElements(this,_,_,_,result) } - /** The child element at a specified index of this XML parent. */ + /** Gets the child element at a specified index of this XML parent. */ XMLElement getChild(int index) { xmlElements(result, _, this, index, _) } - /** A child element of this XML parent. */ + /** Gets a child element of this XML parent. */ XMLElement getAChild() { xmlElements(result,_,this,_,_) } - /** A child element of this XML parent with the given `name`. */ + /** Gets a child element of this XML parent with the given `name`. */ XMLElement getAChild(string name) { xmlElements(result,_,this,_,_) and result.hasName(name) } - /** A comment that is a child of this XML parent. */ + /** Gets a comment that is a child of this XML parent. */ XMLComment getAComment() { xmlComments(result,_,this,_) } - /** A character sequence that is a child of this XML parent. */ + /** Gets a character sequence that is a child of this XML parent. */ XMLCharacters getACharactersSet() { xmlChars(result,_,this,_,_,_) } - /** The depth in the tree. (Overridden in XMLElement.) */ + /** Gets the depth in the tree. (Overridden in XMLElement.) */ int getDepth() { result = 0 } - /** The number of child XML elements of this XML parent. */ + /** Gets the number of child XML elements of this XML parent. */ int getNumberOfChildren() { result = count(XMLElement e | xmlElements(e,_,this,_,_)) } - /** The number of places in the body of this XML parent where text occurs. */ + /** Gets the number of places in the body of this XML parent where text occurs. */ int getNumberOfCharacterSets() { result = count(int pos | xmlChars(_,_,this,pos,_,_)) } @@ -96,12 +96,12 @@ class XMLParent extends @xmlparent { ) } - /** The text value contained in this XML parent. */ + /** Gets the text value contained in this XML parent. */ string getTextValue() { result = allCharactersString() } - /** A printable representation of this XML parent. */ + /** Gets a printable representation of this XML parent. */ string toString() { result = this.getName() } } @@ -111,51 +111,52 @@ class XMLFile extends XMLParent, File { xmlEncoding(this,_) } - /** A printable representation of this XML file. */ + /** Gets a printable representation of this XML file. */ override string toString() { result = XMLParent.super.toString() } - /** The name of this XML file. */ + /** Gets the name of this XML file. */ override string getName() { files(this,result,_,_,_) } - /** The path of this XML file. */ + /** Gets the path of this XML file. */ string getPath() { files(this,_,result,_,_) } - /** The path of the folder that contains this XML file. */ + /** Gets the path of the folder that contains this XML file. */ string getFolder() { result = this.getPath().substring(0, this.getPath().length()-this.getName().length()) } - /** The encoding of this XML file. */ + /** Gets the encoding of this XML file. */ string getEncoding() { xmlEncoding(this,result) } - /** The XML file itself. */ + /** Gets the XML file itself. */ override XMLFile getFile() { result = this } - /** A top-most element in an XML file. */ + /** Gets a top-most element in an XML file. */ XMLElement getARootElement() { result = this.getAChild() } - /** A DTD associated with this XML file. */ + /** Gets a DTD associated with this XML file. */ XMLDTD getADTD() { xmlDTDs(result,_,_,_,this) } } /** A "Document Type Definition" of an XML file. */ class XMLDTD extends XMLLocatable, @xmldtd { - /** The name of the root element of this DTD. */ + /** Gets the name of the root element of this DTD. */ string getRoot() { xmlDTDs(this,result,_,_,_) } - /** The public ID of this DTD. */ + /** Gets the public ID of this DTD. */ string getPublicId() { xmlDTDs(this,_,result,_,_) } - /** The system ID of this DTD. */ + /** Gets the system ID of this DTD. */ string getSystemId() { xmlDTDs(this,_,_,result,_) } - /** Whether this DTD is public. */ + /** Holds if this DTD is public. */ predicate isPublic() { not xmlDTDs(this,_,"",_,_) } - /** The parent of this DTD. */ + /** Gets the parent of this DTD. */ XMLParent getParent() { xmlDTDs(this,_,_,_,result) } + /** Gets a printable representation of this DTD. */ override string toString() { (this.isPublic() and result = this.getRoot() + " PUBLIC '" + this.getPublicId() + "' '" + @@ -168,89 +169,87 @@ class XMLDTD extends XMLLocatable, @xmldtd { /** An XML tag in an XML file. */ class XMLElement extends @xmlelement, XMLParent, XMLLocatable { - /** Whether this XML element has the given `name`. */ + /** Holds if this XML element has the given `name`. */ predicate hasName(string name) { name = getName() } - /** The name of this XML element. */ - override + /** Gets the name of this XML element. */ override string getName() { xmlElements(this,result,_,_,_) } - /** The XML file in which this XML element occurs. */ + /** Gets the XML file in which this XML element occurs. */ override XMLFile getFile() { xmlElements(this,_,_,_,result) } - /** The parent of this XML element. */ + /** Gets the parent of this XML element. */ XMLParent getParent() { xmlElements(this,_,result,_,_) } - /** The index of this XML element among its parent's children. */ + /** Gets the index of this XML element among its parent's children. */ int getIndex() { xmlElements(this, _, _, result, _) } - /** Whether this XML element has a namespace. */ + /** Holds if this XML element has a namespace. */ predicate hasNamespace() { xmlHasNs(this,_,_) } - /** The namespace of this XML element, if any. */ + /** Gets the namespace of this XML element, if any. */ XMLNamespace getNamespace() { xmlHasNs(this,result,_) } - /** The index of this XML element among its parent's children. */ + /** Gets the index of this XML element among its parent's children. */ int getElementPositionIndex() { xmlElements(this,_,_,result,_) } - /** The depth of this element within the XML file tree structure. */ + /** Gets the depth of this element within the XML file tree structure. */ override int getDepth() { result = this.getParent().getDepth() + 1 } - /** An XML attribute of this XML element. */ + /** Gets an XML attribute of this XML element. */ XMLAttribute getAnAttribute() { result.getElement() = this } - /** The attribute with the specified `name`, if any. */ + /** Gets the attribute with the specified `name`, if any. */ XMLAttribute getAttribute(string name) { result.getElement() = this and result.getName() = name } - /** Whether this XML element has an attribute with the specified `name`. */ + /** Holds if this XML element has an attribute with the specified `name`. */ predicate hasAttribute(string name) { exists(XMLAttribute a| a = this.getAttribute(name)) } - /** The value of the attribute with the specified `name`, if any. */ + /** Gets the value of the attribute with the specified `name`, if any. */ string getAttributeValue(string name) { result = this.getAttribute(name).getValue() } - /** A printable representation of this XML element. */ - override + /** Gets a printable representation of this XML element. */ override string toString() { result = XMLParent.super.toString() } } /** An attribute that occurs inside an XML element. */ class XMLAttribute extends @xmlattribute, XMLLocatable { - /** The name of this attribute. */ + /** Gets the name of this attribute. */ string getName() { xmlAttrs(this,_,result,_,_,_) } - /** The XML element to which this attribute belongs. */ + /** Gets the XML element to which this attribute belongs. */ XMLElement getElement() { xmlAttrs(this,result,_,_,_,_) } - /** Whether this attribute has a namespace. */ + /** Holds if this attribute has a namespace. */ predicate hasNamespace() { xmlHasNs(this,_,_) } - /** The namespace of this attribute, if any. */ + /** Gets the namespace of this attribute, if any. */ XMLNamespace getNamespace() { xmlHasNs(this,result,_) } - /** The value of this attribute. */ + /** Gets the value of this attribute. */ string getValue() { xmlAttrs(this,_,_,result,_,_) } - /** A printable representation of this XML attribute. */ + /** Gets a printable representation of this XML attribute. */ override string toString() { result = this.getName() + "=" + this.getValue() } } /** A namespace used in an XML file */ class XMLNamespace extends XMLLocatable, @xmlnamespace { - /** The prefix of this namespace. */ + /** Gets the prefix of this namespace. */ string getPrefix() { xmlNs(this,result,_,_) } - /** The URI of this namespace. */ + /** Gets the URI of this namespace. */ string getURI() { xmlNs(this,_,result,_) } - /** Whether this namespace has no prefix. */ + /** Holds if this namespace has no prefix. */ predicate isDefault() { this.getPrefix() = "" } override string toString() { @@ -261,13 +260,13 @@ class XMLNamespace extends XMLLocatable, @xmlnamespace { /** A comment of the form `` is an XML comment. */ class XMLComment extends @xmlcomment, XMLLocatable { - /** The text content of this XML comment. */ + /** Gets the text content of this XML comment. */ string getText() { xmlComments(this,result,_,_) } - /** The parent of this XML comment. */ + /** Gets the parent of this XML comment. */ XMLParent getParent() { xmlComments(this,_,result,_) } - /** A printable representation of this XML comment. */ + /** Gets a printable representation of this XML comment. */ override string toString() { result = this.getText() } } @@ -276,15 +275,15 @@ class XMLComment extends @xmlcomment, XMLLocatable { * closing tags of an XML element, excluding other elements. */ class XMLCharacters extends @xmlcharacters, XMLLocatable { - /** The content of this character sequence. */ + /** Gets the content of this character sequence. */ string getCharacters() { xmlChars(this,result,_,_,_,_) } - /** The parent of this character sequence. */ + /** Gets the parent of this character sequence. */ XMLParent getParent() { xmlChars(this,_,result,_,_,_) } - /** Whether this character sequence is CDATA. */ + /** Holds if this character sequence is CDATA. */ predicate isCDATA() { xmlChars(this,_,_,_,1,_) } - /** A printable representation of this XML character sequence. */ + /** Gets a printable representation of this XML character sequence. */ override string toString() { result = this.getCharacters() } } diff --git a/javascript/ql/src/semmle/javascript/XML.qll b/javascript/ql/src/semmle/javascript/XML.qll index c07e44294f58..76c43c0503fa 100755 --- a/javascript/ql/src/semmle/javascript/XML.qll +++ b/javascript/ql/src/semmle/javascript/XML.qll @@ -6,7 +6,7 @@ import javascript /** An XML element that has a location. */ abstract class XMLLocatable extends @xmllocatable { - /** The source location for this element. */ + /** Gets the source location for this element. */ Location getLocation() { xmllocations(this,result) } /** @@ -33,38 +33,38 @@ abstract class XMLLocatable extends @xmllocatable { */ class XMLParent extends @xmlparent { /** - * A printable representation of this XML parent. + * Gets a printable representation of this XML parent. * (Intended to be overridden in subclasses.) */ abstract string getName(); - /** The file to which this XML parent belongs. */ + /** Gets the file to which this XML parent belongs. */ XMLFile getFile() { result = this or xmlElements(this,_,_,_,result) } - /** The child element at a specified index of this XML parent. */ + /** Gets the child element at a specified index of this XML parent. */ XMLElement getChild(int index) { xmlElements(result, _, this, index, _) } - /** A child element of this XML parent. */ + /** Gets a child element of this XML parent. */ XMLElement getAChild() { xmlElements(result,_,this,_,_) } - /** A child element of this XML parent with the given `name`. */ + /** Gets a child element of this XML parent with the given `name`. */ XMLElement getAChild(string name) { xmlElements(result,_,this,_,_) and result.hasName(name) } - /** A comment that is a child of this XML parent. */ + /** Gets a comment that is a child of this XML parent. */ XMLComment getAComment() { xmlComments(result,_,this,_) } - /** A character sequence that is a child of this XML parent. */ + /** Gets a character sequence that is a child of this XML parent. */ XMLCharacters getACharactersSet() { xmlChars(result,_,this,_,_,_) } - /** The depth in the tree. (Overridden in XMLElement.) */ + /** Gets the depth in the tree. (Overridden in XMLElement.) */ int getDepth() { result = 0 } - /** The number of child XML elements of this XML parent. */ + /** Gets the number of child XML elements of this XML parent. */ int getNumberOfChildren() { result = count(XMLElement e | xmlElements(e,_,this,_,_)) } - /** The number of places in the body of this XML parent where text occurs. */ + /** Gets the number of places in the body of this XML parent where text occurs. */ int getNumberOfCharacterSets() { result = count(int pos | xmlChars(_,_,this,pos,_,_)) } @@ -87,12 +87,12 @@ class XMLParent extends @xmlparent { ) } - /** The text value contained in this XML parent. */ + /** Gets the text value contained in this XML parent. */ string getTextValue() { result = allCharactersString() } - /** A printable representation of this XML parent. */ + /** Gets a printable representation of this XML parent. */ string toString() { result = this.getName() } } @@ -102,46 +102,46 @@ class XMLFile extends XMLParent, File { xmlEncoding(this,_) } - /** A printable representation of this XML file. */ + /** Gets a printable representation of this XML file. */ override string toString() { result = XMLParent.super.toString() } - /** The name of this XML file. */ + /** Gets the name of this XML file. */ override string getName() { result = File.super.getAbsolutePath() } - /** The encoding of this XML file. */ + /** Gets the encoding of this XML file. */ string getEncoding() { xmlEncoding(this,result) } - /** The XML file itself. */ + /** Gets the XML file itself. */ override XMLFile getFile() { result = this } - /** A top-most element in an XML file. */ + /** Gets a top-most element in an XML file. */ XMLElement getARootElement() { result = this.getAChild() } - /** A DTD associated with this XML file. */ + /** Gets a DTD associated with this XML file. */ XMLDTD getADTD() { xmlDTDs(result,_,_,_,this) } } /** A "Document Type Definition" of an XML file. */ class XMLDTD extends @xmldtd { - /** The name of the root element of this DTD. */ + /** Gets the name of the root element of this DTD. */ string getRoot() { xmlDTDs(this,result,_,_,_) } - /** The public ID of this DTD. */ + /** Gets the public ID of this DTD. */ string getPublicId() { xmlDTDs(this,_,result,_,_) } - /** The system ID of this DTD. */ + /** Gets the system ID of this DTD. */ string getSystemId() { xmlDTDs(this,_,_,result,_) } /** Holds if this DTD is public. */ predicate isPublic() { not xmlDTDs(this,_,"",_,_) } - /** The parent of this DTD. */ + /** Gets the parent of this DTD. */ XMLParent getParent() { xmlDTDs(this,_,_,_,result) } - /** A printable representation of this DTD. */ + /** Gets a printable representation of this DTD. */ string toString() { (this.isPublic() and result = this.getRoot() + " PUBLIC '" + this.getPublicId() + "' '" + @@ -157,37 +157,37 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable { /** Holds if this XML element has the given `name`. */ predicate hasName(string name) { name = getName() } - /** The name of this XML element. */ + /** Gets the name of this XML element. */ override string getName() { xmlElements(this,result,_,_,_) } - /** The XML file in which this XML element occurs. */ + /** Gets the XML file in which this XML element occurs. */ override XMLFile getFile() { xmlElements(this,_,_,_,result) } - /** The parent of this XML element. */ + /** Gets the parent of this XML element. */ XMLParent getParent() { xmlElements(this,_,result,_,_) } - /** The index of this XML element among its parent's children. */ + /** Gets the index of this XML element among its parent's children. */ int getIndex() { xmlElements(this, _, _, result, _) } /** Holds if this XML element has a namespace. */ predicate hasNamespace() { xmlHasNs(this,_,_) } - /** The namespace of this XML element, if any. */ + /** Gets the namespace of this XML element, if any. */ XMLNamespace getNamespace() { xmlHasNs(this,result,_) } - /** The index of this XML element among its parent's children. */ + /** Gets the index of this XML element among its parent's children. */ int getElementPositionIndex() { xmlElements(this,_,_,result,_) } - /** The depth of this element within the XML file tree structure. */ + /** Gets the depth of this element within the XML file tree structure. */ override int getDepth() { result = this.getParent().getDepth() + 1 } - /** An XML attribute of this XML element. */ + /** Gets an XML attribute of this XML element. */ XMLAttribute getAnAttribute() { result.getElement() = this } - /** The attribute with the specified `name`, if any. */ + /** Gets the attribute with the specified `name`, if any. */ XMLAttribute getAttribute(string name) { result.getElement() = this and result.getName() = name } @@ -197,49 +197,49 @@ class XMLElement extends @xmlelement, XMLParent, XMLLocatable { exists(XMLAttribute a| a = this.getAttribute(name)) } - /** The value of the attribute with the specified `name`, if any. */ + /** Gets the value of the attribute with the specified `name`, if any. */ string getAttributeValue(string name) { result = this.getAttribute(name).getValue() } - /** A printable representation of this XML element. */ + /** Gets a printable representation of this XML element. */ override string toString() { result = XMLParent.super.toString() } } /** An attribute that occurs inside an XML element. */ class XMLAttribute extends @xmlattribute, XMLLocatable { - /** The name of this attribute. */ + /** Gets the name of this attribute. */ string getName() { xmlAttrs(this,_,result,_,_,_) } - /** The XML element to which this attribute belongs. */ + /** Gets the XML element to which this attribute belongs. */ XMLElement getElement() { xmlAttrs(this,result,_,_,_,_) } /** Holds if this attribute has a namespace. */ predicate hasNamespace() { xmlHasNs(this,_,_) } - /** The namespace of this attribute, if any. */ + /** Gets the namespace of this attribute, if any. */ XMLNamespace getNamespace() { xmlHasNs(this,result,_) } - /** The value of this attribute. */ + /** Gets the value of this attribute. */ string getValue() { xmlAttrs(this,_,_,result,_,_) } - /** A printable representation of this XML attribute. */ + /** Gets a printable representation of this XML attribute. */ override string toString() { result = this.getName() + "=" + this.getValue() } } /** A namespace used in an XML file */ class XMLNamespace extends @xmlnamespace { - /** The prefix of this namespace. */ + /** Gets the prefix of this namespace. */ string getPrefix() { xmlNs(this,result,_,_) } - /** The URI of this namespace. */ + /** Gets the URI of this namespace. */ string getURI() { xmlNs(this,_,result,_) } /** Holds if this namespace has no prefix. */ predicate isDefault() { this.getPrefix() = "" } - /** A printable representation of this XML namespace. */ + /** Gets a printable representation of this XML namespace. */ string toString() { (this.isDefault() and result = this.getURI()) or (not this.isDefault() and result = this.getPrefix() + ":" + this.getURI()) @@ -248,13 +248,13 @@ class XMLNamespace extends @xmlnamespace { /** A comment of the form `` is an XML comment. */ class XMLComment extends @xmlcomment, XMLLocatable { - /** The text content of this XML comment. */ + /** Gets the text content of this XML comment. */ string getText() { xmlComments(this,result,_,_) } - /** The parent of this XML comment. */ + /** Gets the parent of this XML comment. */ XMLParent getParent() { xmlComments(this,_,result,_) } - /** A printable representation of this XML comment. */ + /** Gets a printable representation of this XML comment. */ override string toString() { result = this.getText() } } @@ -263,15 +263,15 @@ class XMLComment extends @xmlcomment, XMLLocatable { * closing tags of an XML element, excluding other elements. */ class XMLCharacters extends @xmlcharacters, XMLLocatable { - /** The content of this character sequence. */ + /** Gets the content of this character sequence. */ string getCharacters() { xmlChars(this,result,_,_,_,_) } - /** The parent of this character sequence. */ + /** Gets the parent of this character sequence. */ XMLParent getParent() { xmlChars(this,_,result,_,_,_) } /** Holds if this character sequence is CDATA. */ predicate isCDATA() { xmlChars(this,_,_,_,1,_) } - /** A printable representation of this XML character sequence. */ + /** Gets a printable representation of this XML character sequence. */ override string toString() { result = this.getCharacters() } } From 9198f5b9bd5cbb1554d4c9773003826752053a37 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Wed, 26 Sep 2018 15:47:21 +0200 Subject: [PATCH 23/33] CPP/CSharp/Java/Javascript: Use concat in XMLParent.allCharactersString(). --- cpp/ql/src/semmle/code/cpp/XML.qll | 8 ++++---- csharp/ql/src/semmle/code/csharp/XML.qll | 8 ++++---- java/ql/src/semmle/code/xml/XML.qll | 8 ++++---- javascript/ql/src/semmle/javascript/XML.qll | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/XML.qll b/cpp/ql/src/semmle/code/cpp/XML.qll index e1cb3abaa92e..36a333da03b7 100644 --- a/cpp/ql/src/semmle/code/cpp/XML.qll +++ b/cpp/ql/src/semmle/code/cpp/XML.qll @@ -67,9 +67,12 @@ class XMLParent extends @xmlparent { } /** + * DEPRECATED: Internal. + * * Append the character sequences of this XML parent from left to right, separated by a space, * up to a specified (zero-based) index. */ + deprecated string charsSetUpTo(int n) { (n = 0 and xmlChars(_,result,this,0,_,_)) or (n > 0 and exists(string chars | xmlChars(_,chars,this,n,_,_) | @@ -78,10 +81,7 @@ class XMLParent extends @xmlparent { /** Append all the character sequences of this XML parent from left to right, separated by a space. */ string allCharactersString() { - exists(int n | n = this.getNumberOfCharacterSets() | - (n = 0 and result = "") or - (n > 0 and result = this.charsSetUpTo(n-1)) - ) + result = concat(string chars, int pos | xmlChars(_, chars, this, pos, _, _) | chars, " " order by pos) } /** Gets the text value contained in this XML parent. */ diff --git a/csharp/ql/src/semmle/code/csharp/XML.qll b/csharp/ql/src/semmle/code/csharp/XML.qll index 1d3206264832..8e434aa7866d 100644 --- a/csharp/ql/src/semmle/code/csharp/XML.qll +++ b/csharp/ql/src/semmle/code/csharp/XML.qll @@ -79,9 +79,12 @@ class XMLParent extends @xmlparent { } /** + * DEPRECATED: Internal. + * * Append the character sequences of this XML parent from left to right, separated by a space, * up to a specified (zero-based) index. */ + deprecated string charsSetUpTo(int n) { (n = 0 and xmlChars(_,result,this,0,_,_)) or (n > 0 and exists(string chars | xmlChars(_,chars,this,n,_,_) | @@ -90,10 +93,7 @@ class XMLParent extends @xmlparent { /** Append all the character sequences of this XML parent from left to right, separated by a space. */ string allCharactersString() { - exists(int n | n = this.getNumberOfCharacterSets() | - (n = 0 and result = "") or - (n > 0 and result = this.charsSetUpTo(n-1)) - ) + result = concat(string chars, int pos | xmlChars(_, chars, this, pos, _, _) | chars, " " order by pos) } /** Gets the text value contained in this XML parent. */ diff --git a/java/ql/src/semmle/code/xml/XML.qll b/java/ql/src/semmle/code/xml/XML.qll index 07fe3efa879a..5c49be9d14c8 100755 --- a/java/ql/src/semmle/code/xml/XML.qll +++ b/java/ql/src/semmle/code/xml/XML.qll @@ -70,9 +70,12 @@ class XMLParent extends @xmlparent { } /** + * DEPRECATED: Internal. + * * Append the character sequences of this XML parent from left to right, separated by a space, * up to a specified (zero-based) index. */ + deprecated string charsSetUpTo(int n) { n = 0 and xmlChars(_,result,this,0,_,_) or @@ -84,10 +87,7 @@ class XMLParent extends @xmlparent { /** Append all the character sequences of this XML parent from left to right, separated by a space. */ string allCharactersString() { - exists(int n | n = this.getNumberOfCharacterSets() | - (n = 0 and result = "") or - (n > 0 and result = this.charsSetUpTo(n-1)) - ) + result = concat(string chars, int pos | xmlChars(_, chars, this, pos, _, _) | chars, " " order by pos) } /** Gets the text value contained in this XML parent. */ diff --git a/javascript/ql/src/semmle/javascript/XML.qll b/javascript/ql/src/semmle/javascript/XML.qll index 76c43c0503fa..bc7e8f2aaa2a 100755 --- a/javascript/ql/src/semmle/javascript/XML.qll +++ b/javascript/ql/src/semmle/javascript/XML.qll @@ -70,9 +70,12 @@ class XMLParent extends @xmlparent { } /** + * DEPRECATED: Internal. + * * Append the character sequences of this XML parent from left to right, separated by a space, * up to a specified (zero-based) index. */ + deprecated string charsSetUpTo(int n) { (n = 0 and xmlChars(_,result,this,0,_,_)) or (n > 0 and exists(string chars | xmlChars(_,chars,this,n,_,_) | @@ -81,10 +84,7 @@ class XMLParent extends @xmlparent { /** Append all the character sequences of this XML parent from left to right, separated by a space. */ string allCharactersString() { - exists(int n | n = this.getNumberOfCharacterSets() | - (n = 0 and result = "") or - (n > 0 and result = this.charsSetUpTo(n-1)) - ) + result = concat(string chars, int pos | xmlChars(_, chars, this, pos, _, _) | chars, " " order by pos) } /** Gets the text value contained in this XML parent. */ From c5d08ffcd417efa851a74d9b5bc49f7c1bc10bff Mon Sep 17 00:00:00 2001 From: Jonas Jensen Date: Wed, 26 Sep 2018 15:52:44 +0200 Subject: [PATCH 24/33] Don't .gitignore .vs/VSWorkspaceSettings.json --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6cf1596143db..b5c88ce04abf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ # editor and OS artifacts *~ -/.vs .DS_STORE # query compilation caches @@ -9,3 +8,7 @@ # qltest projects and artifacts */ql/test/**/*.testproj */ql/test/**/*.actual + +# Visual studio temporaries, except a file used by QL4VS +.vs/* +!.vs/VSWorkspaceSettings.json From b3dbb44e3ad02609de06e4f4680520c4e0964f57 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Thu, 27 Sep 2018 15:39:26 +0200 Subject: [PATCH 25/33] Java: Improve performance of TypeFlow. --- .../semmle/code/java/dataflow/TypeFlow.qll | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/java/ql/src/semmle/code/java/dataflow/TypeFlow.qll b/java/ql/src/semmle/code/java/dataflow/TypeFlow.qll index a4e456839475..e545fc93f5d5 100644 --- a/java/ql/src/semmle/code/java/dataflow/TypeFlow.qll +++ b/java/ql/src/semmle/code/java/dataflow/TypeFlow.qll @@ -190,30 +190,40 @@ private Type elementType(RefType t) { ) } +private predicate upcastEnhancedForStmtAux(BaseSsaUpdate v, RefType t, RefType t1, RefType t2) { + exists(EnhancedForStmt for | + for.getVariable() = v.getDefiningExpr() and + v.getSourceVariable().getType().getErasure() = t2 and + t = boxIfNeeded(elementType(for.getExpr().getType())) and + t.getErasure() = t1 + ) +} + /** * Holds if `v` is the iteration variable of an enhanced for statement, `t` is * the type of the elements being iterated over, and this type is more precise * than the type of `v`. */ private predicate upcastEnhancedForStmt(BaseSsaUpdate v, RefType t) { - exists(EnhancedForStmt for, RefType t1, RefType t2 | - for.getVariable() = v.getDefiningExpr() and - v.getSourceVariable().getType().getErasure() = t2 and - t = boxIfNeeded(elementType(for.getExpr().getType())) and - t.getErasure() = t1 and + exists(RefType t1, RefType t2 | + upcastEnhancedForStmtAux(v, t, t1, t2) and t1.getASourceSupertype+() = t2 ) } +private predicate downcastSuccessorAux(CastExpr cast, BaseSsaVariable v, RefType t, RefType t1, RefType t2) { + cast.getExpr() = v.getAUse() and + t = cast.getType() and + t1 = t.getErasure() and + t2 = v.getSourceVariable().getType().getErasure() +} + /** * Holds if `va` is an access to a value that has previously been downcast to `t`. */ private predicate downcastSuccessor(VarAccess va, RefType t) { exists(CastExpr cast, BaseSsaVariable v, RefType t1, RefType t2 | - cast.getExpr() = v.getAUse() and - t = cast.getType() and - t1 = t.getErasure() and - t2 = v.getSourceVariable().getType().getErasure() and + downcastSuccessorAux(cast, v, t, t1, t2) and t1.getASourceSupertype+() = t2 and va = v.getAUse() and dominates(cast, va) and From f323fa1df86ac49cedffcbf179140e99de8ce124 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Thu, 27 Sep 2018 13:06:57 -0700 Subject: [PATCH 26/33] C++: test changes from previous commit The IR for the conversion to bool results in a comparison where the left hand side is not the result of any expression in the AST, so they can't be usefully converted back to the AST --- .../controlflow/guards-ir/ASTGuardsCompare.expected | 2 -- .../controlflow/guards-ir/ASTGuardsEnsure.expected | 1 - 2 files changed, 3 deletions(-) diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected index d786c284d473..58068f3991df 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected @@ -14,8 +14,6 @@ | 17 | y < 1+1 when ... > ... is false | | 17 | y >= 1+1 when ... && ... is true | | 17 | y >= 1+1 when ... > ... is true | -| 18 | call to get != call to get+0 when call to get is true | -| 18 | call to get == call to get+0 when call to get is false | | 26 | 0 < x+0 when ... > ... is true | | 26 | 0 >= x+0 when ... > ... is false | | 26 | x < 0+1 when ... > ... is false | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected index 8eb3eb83e277..d6783e7fc3a8 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected @@ -154,7 +154,6 @@ | test.c:109:9:109:23 | ... \|\| ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | | test.c:109:19:109:23 | ... < ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | 0 | 0 | 113 | 113 | | test.c:109:19:109:23 | ... < ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | -| test.cpp:18:8:18:10 | call to get | test.cpp:18:8:18:10 | call to get | != | test.cpp:18:8:18:10 | call to get | 0 | 19 | 19 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 34 | 34 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | From b6cc6a3b2372b0f500840d25f5edcde2dd508213 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Thu, 27 Sep 2018 13:09:15 -0700 Subject: [PATCH 27/33] C++: Fix BinaryLogicalOperators always being guards --- cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll | 5 +++-- .../library-tests/controlflow/guards-ir/ASTGuards.expected | 3 +++ .../controlflow/guards-ir/ASTGuardsControl.expected | 4 ++++ .../library-tests/controlflow/guards-ir/IRGuards.expected | 2 ++ .../controlflow/guards-ir/IRGuardsControl.expected | 2 ++ cpp/ql/test/library-tests/controlflow/guards-ir/test.c | 5 +++++ 6 files changed, 19 insertions(+), 2 deletions(-) diff --git a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll index b470447788a8..55d5d4d8a84c 100644 --- a/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll +++ b/cpp/ql/src/semmle/code/cpp/controlflow/IRGuards.qll @@ -10,12 +10,13 @@ class GuardCondition extends Expr { exists(IRGuardCondition ir | this = ir.getUnconvertedResultExpression()) or // no binary operators in the IR - exists(Instruction ir | - this.(BinaryLogicalOperation).getAnOperand().getFullyConverted() = ir.getAST() + exists(GuardCondition gc | + this.(BinaryLogicalOperation).getAnOperand()= gc ) or // the IR short-circuits if(!x) ( + // don't produce a guard condition for `y = !x` and other non-short-circuited cases not exists (Instruction inst | this.getFullyConverted() = inst.getAST()) and exists(IRGuardCondition ir | this.(NotExpr).getOperand() = ir.getAST()) ) diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected index b73e7064339e..71eddd209803 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected @@ -27,6 +27,9 @@ | test.c:138:9:138:9 | i | | test.c:146:7:146:8 | ! ... | | test.c:146:8:146:8 | x | +| test.c:152:10:152:10 | x | +| test.c:152:10:152:15 | ... && ... | +| test.c:152:15:152:15 | y | | test.cpp:18:8:18:10 | call to get | | test.cpp:31:7:31:13 | ... == ... | | test.cpp:42:13:42:20 | call to getABool | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected index d4a5295b8771..c05f37215fcc 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected @@ -82,6 +82,10 @@ | test.c:138:9:138:9 | i | true | 138 | 139 | | test.c:146:7:146:8 | ! ... | true | 146 | 147 | | test.c:146:8:146:8 | x | false | 146 | 147 | +| test.c:152:10:152:10 | x | true | 151 | 152 | +| test.c:152:10:152:10 | x | true | 152 | 152 | +| test.c:152:10:152:15 | ... && ... | true | 151 | 152 | +| test.c:152:15:152:15 | y | true | 151 | 152 | | test.cpp:18:8:18:10 | call to get | true | 19 | 19 | | test.cpp:31:7:31:13 | ... == ... | false | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected index 72892f0e0336..9720f46530de 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected @@ -21,6 +21,8 @@ | test.c:137:7:137:7 | 0 | | test.c:138:9:138:9 | i | | test.c:146:8:146:8 | x | +| test.c:152:10:152:10 | x | +| test.c:152:15:152:15 | y | | test.cpp:18:8:18:12 | (bool)... | | test.cpp:31:7:31:13 | ... == ... | | test.cpp:42:13:42:20 | call to getABool | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected index 3e8fbb42f1a1..3c96e1eaf84c 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected @@ -78,6 +78,8 @@ | test.c:137:7:137:7 | 0 | true | 139 | 139 | | test.c:138:9:138:9 | i | true | 139 | 139 | | test.c:146:8:146:8 | x | false | 147 | 147 | +| test.c:152:10:152:10 | x | true | 152 | 152 | +| test.c:152:15:152:15 | y | true | 152 | 152 | | test.cpp:18:8:18:12 | (bool)... | true | 0 | 0 | | test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | | test.cpp:31:7:31:13 | ... == ... | true | 30 | 30 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/test.c b/cpp/ql/test/library-tests/controlflow/guards-ir/test.c index 186244d4fca2..384d265440fb 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/test.c +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/test.c @@ -147,3 +147,8 @@ void test5(int x) { test3(); } } + +void test6(int x, int y) { + return x && y; +} + From 93732d8b5a8e5964c823a61937e17cbfc4d17842 Mon Sep 17 00:00:00 2001 From: Robert Marsh Date: Thu, 27 Sep 2018 13:53:02 -0700 Subject: [PATCH 28/33] C++: Combine IR guard tests into one ql file This is motivated by test performance; IR compilation happens separately for each test and takes a bit over a minute, so combining these 8 tests saves about 10 minutes of test running. --- .../controlflow/guards-ir/ASTGuards.expected | 35 - .../controlflow/guards-ir/ASTGuards.ql | 5 - .../guards-ir/ASTGuardsCompare.expected | 88 --- .../controlflow/guards-ir/ASTGuardsCompare.ql | 25 - .../guards-ir/ASTGuardsControl.expected | 95 --- .../controlflow/guards-ir/ASTGuardsControl.ql | 17 - .../guards-ir/ASTGuardsEnsure.expected | 164 ---- .../controlflow/guards-ir/ASTGuardsEnsure.ql | 23 - .../controlflow/guards-ir/IRGuards.expected | 28 - .../controlflow/guards-ir/IRGuards.ql | 5 - .../guards-ir/IRGuardsCompare.expected | 104 --- .../controlflow/guards-ir/IRGuardsCompare.ql | 30 - .../guards-ir/IRGuardsControl.expected | 88 --- .../controlflow/guards-ir/IRGuardsControl.ql | 16 - .../guards-ir/IRGuardsEnsure.expected | 152 ---- .../controlflow/guards-ir/IRGuardsEnsure.ql | 23 - .../controlflow/guards-ir/tests.expected | 730 ++++++++++++++++++ .../controlflow/guards-ir/tests.ql | 91 +++ 18 files changed, 821 insertions(+), 898 deletions(-) delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.ql delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.ql delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.ql delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.ql delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.ql delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.expected delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.ql delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.ql delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.expected delete mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.ql create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected create mode 100644 cpp/ql/test/library-tests/controlflow/guards-ir/tests.ql diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected deleted file mode 100644 index 71eddd209803..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.expected +++ /dev/null @@ -1,35 +0,0 @@ -| test.c:7:9:7:13 | ... > ... | -| test.c:17:8:17:12 | ... < ... | -| test.c:17:8:17:21 | ... && ... | -| test.c:17:17:17:21 | ... > ... | -| test.c:26:11:26:15 | ... > ... | -| test.c:34:16:34:21 | ... < ... | -| test.c:42:16:42:21 | ... < ... | -| test.c:44:12:44:16 | ... > ... | -| test.c:45:16:45:20 | ... > ... | -| test.c:58:9:58:14 | ... == ... | -| test.c:58:9:58:23 | ... \|\| ... | -| test.c:58:19:58:23 | ... < ... | -| test.c:75:9:75:14 | ... == ... | -| test.c:85:8:85:13 | ... == ... | -| test.c:85:8:85:23 | ... && ... | -| test.c:85:18:85:23 | ... != ... | -| test.c:94:11:94:16 | ... != ... | -| test.c:102:16:102:21 | ... < ... | -| test.c:109:9:109:14 | ... == ... | -| test.c:109:9:109:23 | ... \|\| ... | -| test.c:109:19:109:23 | ... < ... | -| test.c:126:7:126:7 | 1 | -| test.c:126:7:126:28 | ... && ... | -| test.c:126:12:126:26 | call to test3_condition | -| test.c:131:7:131:7 | b | -| test.c:137:7:137:7 | 0 | -| test.c:138:9:138:9 | i | -| test.c:146:7:146:8 | ! ... | -| test.c:146:8:146:8 | x | -| test.c:152:10:152:10 | x | -| test.c:152:10:152:15 | ... && ... | -| test.c:152:15:152:15 | y | -| test.cpp:18:8:18:10 | call to get | -| test.cpp:31:7:31:13 | ... == ... | -| test.cpp:42:13:42:20 | call to getABool | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.ql deleted file mode 100644 index 3c8e19bee412..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuards.ql +++ /dev/null @@ -1,5 +0,0 @@ -import cpp -import semmle.code.cpp.controlflow.IRGuards - -from GuardCondition guard -select guard \ No newline at end of file diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected deleted file mode 100644 index 58068f3991df..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.expected +++ /dev/null @@ -1,88 +0,0 @@ -| 7 | 0 < x+0 when ... > ... is true | -| 7 | 0 >= x+0 when ... > ... is false | -| 7 | x < 0+1 when ... > ... is false | -| 7 | x >= 0+1 when ... > ... is true | -| 17 | 0 < x+1 when ... < ... is false | -| 17 | 0 >= x+1 when ... && ... is true | -| 17 | 0 >= x+1 when ... < ... is true | -| 17 | 1 < y+0 when ... && ... is true | -| 17 | 1 < y+0 when ... > ... is true | -| 17 | 1 >= y+0 when ... > ... is false | -| 17 | x < 0+0 when ... && ... is true | -| 17 | x < 0+0 when ... < ... is true | -| 17 | x >= 0+0 when ... < ... is false | -| 17 | y < 1+1 when ... > ... is false | -| 17 | y >= 1+1 when ... && ... is true | -| 17 | y >= 1+1 when ... > ... is true | -| 26 | 0 < x+0 when ... > ... is true | -| 26 | 0 >= x+0 when ... > ... is false | -| 26 | x < 0+1 when ... > ... is false | -| 26 | x >= 0+1 when ... > ... is true | -| 31 | - ... != x+0 when ... == ... is false | -| 31 | - ... == x+0 when ... == ... is true | -| 31 | x != - ...+0 when ... == ... is false | -| 31 | x == - ...+0 when ... == ... is true | -| 34 | 10 < j+1 when ... < ... is false | -| 34 | 10 >= j+1 when ... < ... is true | -| 34 | j < 10+0 when ... < ... is true | -| 34 | j >= 10+0 when ... < ... is false | -| 42 | 10 < j+1 when ... < ... is false | -| 42 | 10 >= j+1 when ... < ... is true | -| 42 | j < 10+0 when ... < ... is true | -| 42 | j >= 10+0 when ... < ... is false | -| 44 | 0 < z+0 when ... > ... is true | -| 44 | 0 >= z+0 when ... > ... is false | -| 44 | z < 0+1 when ... > ... is false | -| 44 | z >= 0+1 when ... > ... is true | -| 45 | 0 < y+0 when ... > ... is true | -| 45 | 0 >= y+0 when ... > ... is false | -| 45 | y < 0+1 when ... > ... is false | -| 45 | y >= 0+1 when ... > ... is true | -| 58 | 0 != x+0 when ... == ... is false | -| 58 | 0 != x+0 when ... \|\| ... is false | -| 58 | 0 < y+1 when ... < ... is false | -| 58 | 0 < y+1 when ... \|\| ... is false | -| 58 | 0 == x+0 when ... == ... is true | -| 58 | 0 >= y+1 when ... < ... is true | -| 58 | x != 0+0 when ... == ... is false | -| 58 | x != 0+0 when ... \|\| ... is false | -| 58 | x == 0+0 when ... == ... is true | -| 58 | y < 0+0 when ... < ... is true | -| 58 | y >= 0+0 when ... < ... is false | -| 58 | y >= 0+0 when ... \|\| ... is false | -| 75 | 0 != x+0 when ... == ... is false | -| 75 | 0 == x+0 when ... == ... is true | -| 75 | x != 0+0 when ... == ... is false | -| 75 | x == 0+0 when ... == ... is true | -| 85 | 0 != x+0 when ... == ... is false | -| 85 | 0 != y+0 when ... != ... is true | -| 85 | 0 != y+0 when ... && ... is true | -| 85 | 0 == x+0 when ... && ... is true | -| 85 | 0 == x+0 when ... == ... is true | -| 85 | 0 == y+0 when ... != ... is false | -| 85 | x != 0+0 when ... == ... is false | -| 85 | x == 0+0 when ... && ... is true | -| 85 | x == 0+0 when ... == ... is true | -| 85 | y != 0+0 when ... != ... is true | -| 85 | y != 0+0 when ... && ... is true | -| 85 | y == 0+0 when ... != ... is false | -| 94 | 0 != x+0 when ... != ... is true | -| 94 | 0 == x+0 when ... != ... is false | -| 94 | x != 0+0 when ... != ... is true | -| 94 | x == 0+0 when ... != ... is false | -| 102 | 10 < j+1 when ... < ... is false | -| 102 | 10 >= j+1 when ... < ... is true | -| 102 | j < 10+0 when ... < ... is true | -| 102 | j >= 10+0 when ... < ... is false | -| 109 | 0 != x+0 when ... == ... is false | -| 109 | 0 != x+0 when ... \|\| ... is false | -| 109 | 0 < y+1 when ... < ... is false | -| 109 | 0 < y+1 when ... \|\| ... is false | -| 109 | 0 == x+0 when ... == ... is true | -| 109 | 0 >= y+1 when ... < ... is true | -| 109 | x != 0+0 when ... == ... is false | -| 109 | x != 0+0 when ... \|\| ... is false | -| 109 | x == 0+0 when ... == ... is true | -| 109 | y < 0+0 when ... < ... is true | -| 109 | y >= 0+0 when ... < ... is false | -| 109 | y >= 0+0 when ... \|\| ... is false | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.ql deleted file mode 100644 index e51e5df741a6..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsCompare.ql +++ /dev/null @@ -1,25 +0,0 @@ -/** - * @name Guards comparison test - * @description List comparison parts. - * @kind test - */ - -import cpp -import semmle.code.cpp.controlflow.IRGuards - - -from GuardCondition guard, Expr left, Expr right, int k, string which, string op, string msg -where -(exists(boolean sense | sense = true and which = "true" or sense = false and which = "false" | - guard.comparesLt(left, right, k, true, sense) and op = " < " - or - guard.comparesLt(left, right, k, false, sense) and op = " >= " - or - guard.comparesEq(left, right, k, true, sense) and op = " == " - or - guard.comparesEq(left, right, k, false, sense) and op = " != " - ) -) -and msg = left + op + right + "+" + k + " when " + guard + " is " + which - -select guard.getLocation().getStartLine(), msg \ No newline at end of file diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected deleted file mode 100644 index c05f37215fcc..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.expected +++ /dev/null @@ -1,95 +0,0 @@ -| test.c:7:9:7:13 | ... > ... | false | 10 | 11 | -| test.c:7:9:7:13 | ... > ... | true | 7 | 9 | -| test.c:17:8:17:12 | ... < ... | true | 17 | 17 | -| test.c:17:8:17:12 | ... < ... | true | 18 | 18 | -| test.c:17:8:17:21 | ... && ... | true | 18 | 18 | -| test.c:17:17:17:21 | ... > ... | true | 18 | 18 | -| test.c:26:11:26:15 | ... > ... | false | 2 | 2 | -| test.c:26:11:26:15 | ... > ... | false | 31 | 34 | -| test.c:26:11:26:15 | ... > ... | false | 34 | 34 | -| test.c:26:11:26:15 | ... > ... | false | 39 | 42 | -| test.c:26:11:26:15 | ... > ... | false | 42 | 42 | -| test.c:26:11:26:15 | ... > ... | false | 42 | 44 | -| test.c:26:11:26:15 | ... > ... | false | 45 | 45 | -| test.c:26:11:26:15 | ... > ... | false | 45 | 47 | -| test.c:26:11:26:15 | ... > ... | false | 48 | 55 | -| test.c:26:11:26:15 | ... > ... | false | 51 | 53 | -| test.c:26:11:26:15 | ... > ... | false | 56 | 58 | -| test.c:26:11:26:15 | ... > ... | false | 58 | 58 | -| test.c:26:11:26:15 | ... > ... | false | 58 | 66 | -| test.c:26:11:26:15 | ... > ... | false | 62 | 62 | -| test.c:26:11:26:15 | ... > ... | true | 26 | 28 | -| test.c:34:16:34:21 | ... < ... | false | 2 | 2 | -| test.c:34:16:34:21 | ... < ... | false | 39 | 42 | -| test.c:34:16:34:21 | ... < ... | false | 42 | 42 | -| test.c:34:16:34:21 | ... < ... | false | 42 | 44 | -| test.c:34:16:34:21 | ... < ... | false | 45 | 45 | -| test.c:34:16:34:21 | ... < ... | false | 45 | 47 | -| test.c:34:16:34:21 | ... < ... | false | 48 | 55 | -| test.c:34:16:34:21 | ... < ... | false | 51 | 53 | -| test.c:34:16:34:21 | ... < ... | false | 56 | 58 | -| test.c:34:16:34:21 | ... < ... | false | 58 | 58 | -| test.c:34:16:34:21 | ... < ... | false | 58 | 66 | -| test.c:34:16:34:21 | ... < ... | false | 62 | 62 | -| test.c:34:16:34:21 | ... < ... | true | 34 | 34 | -| test.c:42:16:42:21 | ... < ... | true | 42 | 42 | -| test.c:42:16:42:21 | ... < ... | true | 42 | 44 | -| test.c:42:16:42:21 | ... < ... | true | 45 | 45 | -| test.c:42:16:42:21 | ... < ... | true | 45 | 47 | -| test.c:42:16:42:21 | ... < ... | true | 48 | 55 | -| test.c:42:16:42:21 | ... < ... | true | 51 | 53 | -| test.c:44:12:44:16 | ... > ... | false | 51 | 53 | -| test.c:44:12:44:16 | ... > ... | true | 45 | 45 | -| test.c:44:12:44:16 | ... > ... | true | 45 | 47 | -| test.c:44:12:44:16 | ... > ... | true | 48 | 55 | -| test.c:45:16:45:20 | ... > ... | false | 48 | 55 | -| test.c:45:16:45:20 | ... > ... | true | 45 | 47 | -| test.c:58:9:58:14 | ... == ... | false | 58 | 58 | -| test.c:58:9:58:14 | ... == ... | false | 62 | 62 | -| test.c:58:9:58:23 | ... \|\| ... | false | 62 | 62 | -| test.c:58:19:58:23 | ... < ... | false | 62 | 62 | -| test.c:75:9:75:14 | ... == ... | false | 78 | 79 | -| test.c:75:9:75:14 | ... == ... | true | 75 | 77 | -| test.c:85:8:85:13 | ... == ... | true | 85 | 85 | -| test.c:85:8:85:13 | ... == ... | true | 86 | 86 | -| test.c:85:8:85:23 | ... && ... | true | 86 | 86 | -| test.c:85:18:85:23 | ... != ... | true | 86 | 86 | -| test.c:94:11:94:16 | ... != ... | false | 70 | 70 | -| test.c:94:11:94:16 | ... != ... | false | 99 | 102 | -| test.c:94:11:94:16 | ... != ... | false | 102 | 102 | -| test.c:94:11:94:16 | ... != ... | false | 107 | 109 | -| test.c:94:11:94:16 | ... != ... | false | 109 | 109 | -| test.c:94:11:94:16 | ... != ... | false | 109 | 117 | -| test.c:94:11:94:16 | ... != ... | false | 113 | 113 | -| test.c:94:11:94:16 | ... != ... | true | 94 | 96 | -| test.c:102:16:102:21 | ... < ... | false | 70 | 70 | -| test.c:102:16:102:21 | ... < ... | false | 107 | 109 | -| test.c:102:16:102:21 | ... < ... | false | 109 | 109 | -| test.c:102:16:102:21 | ... < ... | false | 109 | 117 | -| test.c:102:16:102:21 | ... < ... | false | 113 | 113 | -| test.c:102:16:102:21 | ... < ... | true | 102 | 102 | -| test.c:109:9:109:14 | ... == ... | false | 109 | 109 | -| test.c:109:9:109:14 | ... == ... | false | 113 | 113 | -| test.c:109:9:109:23 | ... \|\| ... | false | 113 | 113 | -| test.c:109:19:109:23 | ... < ... | false | 113 | 113 | -| test.c:126:7:126:7 | 1 | true | 126 | 126 | -| test.c:126:7:126:7 | 1 | true | 126 | 128 | -| test.c:126:7:126:28 | ... && ... | true | 126 | 128 | -| test.c:126:12:126:26 | call to test3_condition | true | 126 | 128 | -| test.c:131:7:131:7 | b | true | 131 | 132 | -| test.c:137:7:137:7 | 0 | true | 137 | 138 | -| test.c:137:7:137:7 | 0 | true | 138 | 139 | -| test.c:138:9:138:9 | i | true | 138 | 139 | -| test.c:146:7:146:8 | ! ... | true | 146 | 147 | -| test.c:146:8:146:8 | x | false | 146 | 147 | -| test.c:152:10:152:10 | x | true | 151 | 152 | -| test.c:152:10:152:10 | x | true | 152 | 152 | -| test.c:152:10:152:15 | ... && ... | true | 151 | 152 | -| test.c:152:15:152:15 | y | true | 151 | 152 | -| test.cpp:18:8:18:10 | call to get | true | 19 | 19 | -| test.cpp:31:7:31:13 | ... == ... | false | 30 | 30 | -| test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | -| test.cpp:31:7:31:13 | ... == ... | true | 30 | 30 | -| test.cpp:31:7:31:13 | ... == ... | true | 31 | 32 | -| test.cpp:42:13:42:20 | call to getABool | false | 53 | 53 | -| test.cpp:42:13:42:20 | call to getABool | true | 43 | 45 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.ql deleted file mode 100644 index 63456cc1f572..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsControl.ql +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @name Guards control test - * @description List which guards control which blocks - * @kind test - */ - -import cpp -import semmle.code.cpp.controlflow.IRGuards - - -from GuardCondition guard, boolean sense, int start, int end -where -exists(BasicBlock block | - guard.controls(block, sense) and - block.hasLocationInfo(_, start, _, end, _) -) -select guard, sense, start, end diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected deleted file mode 100644 index d6783e7fc3a8..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.expected +++ /dev/null @@ -1,164 +0,0 @@ -| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | < | test.c:7:13:7:13 | 0 | 1 | 10 | 11 | -| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | >= | test.c:7:13:7:13 | 0 | 1 | 7 | 9 | -| test.c:7:9:7:13 | ... > ... | test.c:7:13:7:13 | 0 | < | test.c:7:9:7:9 | x | 0 | 7 | 9 | -| test.c:7:9:7:13 | ... > ... | test.c:7:13:7:13 | 0 | >= | test.c:7:9:7:9 | x | 0 | 10 | 11 | -| test.c:17:8:17:12 | ... < ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 17 | 17 | -| test.c:17:8:17:12 | ... < ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 18 | 18 | -| test.c:17:8:17:12 | ... < ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 17 | 17 | -| test.c:17:8:17:12 | ... < ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 18 | 18 | -| test.c:17:8:17:21 | ... && ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 18 | 18 | -| test.c:17:8:17:21 | ... && ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 18 | 18 | -| test.c:17:8:17:21 | ... && ... | test.c:17:17:17:17 | y | >= | test.c:17:21:17:21 | 1 | 1 | 18 | 18 | -| test.c:17:8:17:21 | ... && ... | test.c:17:21:17:21 | 1 | < | test.c:17:17:17:17 | y | 0 | 18 | 18 | -| test.c:17:17:17:21 | ... > ... | test.c:17:17:17:17 | y | >= | test.c:17:21:17:21 | 1 | 1 | 18 | 18 | -| test.c:17:17:17:21 | ... > ... | test.c:17:21:17:21 | 1 | < | test.c:17:17:17:17 | y | 0 | 18 | 18 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 2 | 2 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 31 | 34 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 34 | 34 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 39 | 42 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 42 | 42 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 42 | 44 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 45 | 45 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 45 | 47 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 48 | 55 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 51 | 53 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 56 | 58 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 58 | 58 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 58 | 66 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 62 | 62 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | >= | test.c:26:15:26:15 | 0 | 1 | 26 | 28 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | < | test.c:26:11:26:11 | x | 0 | 26 | 28 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 2 | 2 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 31 | 34 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 34 | 34 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 39 | 42 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 42 | 42 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 42 | 44 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 45 | 45 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 45 | 47 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 48 | 55 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 51 | 53 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 56 | 58 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 58 | 58 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 58 | 66 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 62 | 62 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | < | test.c:34:20:34:21 | 10 | 0 | 34 | 34 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 2 | 2 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 39 | 42 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 42 | 42 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 42 | 44 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 45 | 45 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 45 | 47 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 48 | 55 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 51 | 53 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 56 | 58 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 58 | 58 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 58 | 66 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 62 | 62 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 2 | 2 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 39 | 42 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 42 | 42 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 42 | 44 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 45 | 45 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 45 | 47 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 48 | 55 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 51 | 53 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 56 | 58 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 58 | 58 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 58 | 66 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 62 | 62 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | >= | test.c:34:16:34:16 | j | 1 | 34 | 34 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 42 | 42 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 42 | 44 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 45 | 45 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 45 | 47 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 48 | 55 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 51 | 53 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 42 | 42 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 42 | 44 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 45 | 45 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 45 | 47 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 48 | 55 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 51 | 53 | -| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | < | test.c:44:16:44:16 | 0 | 1 | 51 | 53 | -| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 45 | 45 | -| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 45 | 47 | -| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 48 | 55 | -| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 45 | 45 | -| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 45 | 47 | -| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 48 | 55 | -| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | >= | test.c:44:12:44:12 | z | 0 | 51 | 53 | -| test.c:45:16:45:20 | ... > ... | test.c:45:16:45:16 | y | < | test.c:45:20:45:20 | 0 | 1 | 48 | 55 | -| test.c:45:16:45:20 | ... > ... | test.c:45:16:45:16 | y | >= | test.c:45:20:45:20 | 0 | 1 | 45 | 47 | -| test.c:45:16:45:20 | ... > ... | test.c:45:20:45:20 | 0 | < | test.c:45:16:45:16 | y | 0 | 45 | 47 | -| test.c:45:16:45:20 | ... > ... | test.c:45:20:45:20 | 0 | >= | test.c:45:16:45:16 | y | 0 | 48 | 55 | -| test.c:58:9:58:14 | ... == ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 58 | 58 | -| test.c:58:9:58:14 | ... == ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 62 | 62 | -| test.c:58:9:58:14 | ... == ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 58 | 58 | -| test.c:58:9:58:14 | ... == ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 62 | 62 | -| test.c:58:9:58:23 | ... \|\| ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 62 | 62 | -| test.c:58:9:58:23 | ... \|\| ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 62 | 62 | -| test.c:58:9:58:23 | ... \|\| ... | test.c:58:19:58:19 | y | >= | test.c:58:23:58:23 | 0 | 0 | 62 | 62 | -| test.c:58:9:58:23 | ... \|\| ... | test.c:58:23:58:23 | 0 | < | test.c:58:19:58:19 | y | 1 | 62 | 62 | -| test.c:58:19:58:23 | ... < ... | test.c:58:19:58:19 | y | >= | test.c:58:23:58:23 | 0 | 0 | 62 | 62 | -| test.c:58:19:58:23 | ... < ... | test.c:58:23:58:23 | 0 | < | test.c:58:19:58:19 | y | 1 | 62 | 62 | -| test.c:75:9:75:14 | ... == ... | test.c:75:9:75:9 | x | != | test.c:75:14:75:14 | 0 | 0 | 78 | 79 | -| test.c:75:9:75:14 | ... == ... | test.c:75:9:75:9 | x | == | test.c:75:14:75:14 | 0 | 0 | 75 | 77 | -| test.c:75:9:75:14 | ... == ... | test.c:75:14:75:14 | 0 | != | test.c:75:9:75:9 | x | 0 | 78 | 79 | -| test.c:75:9:75:14 | ... == ... | test.c:75:14:75:14 | 0 | == | test.c:75:9:75:9 | x | 0 | 75 | 77 | -| test.c:85:8:85:13 | ... == ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 85 | 85 | -| test.c:85:8:85:13 | ... == ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 86 | 86 | -| test.c:85:8:85:13 | ... == ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 85 | 85 | -| test.c:85:8:85:13 | ... == ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 86 | 86 | -| test.c:85:8:85:23 | ... && ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 86 | 86 | -| test.c:85:8:85:23 | ... && ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 86 | 86 | -| test.c:85:8:85:23 | ... && ... | test.c:85:18:85:18 | y | != | test.c:85:23:85:23 | 0 | 0 | 86 | 86 | -| test.c:85:8:85:23 | ... && ... | test.c:85:23:85:23 | 0 | != | test.c:85:18:85:18 | y | 0 | 86 | 86 | -| test.c:85:18:85:23 | ... != ... | test.c:85:18:85:18 | y | != | test.c:85:23:85:23 | 0 | 0 | 86 | 86 | -| test.c:85:18:85:23 | ... != ... | test.c:85:23:85:23 | 0 | != | test.c:85:18:85:18 | y | 0 | 86 | 86 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | != | test.c:94:16:94:16 | 0 | 0 | 94 | 96 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 70 | 70 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 99 | 102 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 102 | 102 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 107 | 109 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 109 | 109 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 109 | 117 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 113 | 113 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | != | test.c:94:11:94:11 | x | 0 | 94 | 96 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 70 | 70 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 99 | 102 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 102 | 102 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 107 | 109 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 109 | 109 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 109 | 117 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 113 | 113 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | < | test.c:102:20:102:21 | 10 | 0 | 102 | 102 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 70 | 70 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 107 | 109 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 109 | 109 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 109 | 117 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 113 | 113 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 70 | 70 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 107 | 109 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 109 | 109 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 109 | 117 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 113 | 113 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | >= | test.c:102:16:102:16 | j | 1 | 102 | 102 | -| test.c:109:9:109:14 | ... == ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 109 | 109 | -| test.c:109:9:109:14 | ... == ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 113 | 113 | -| test.c:109:9:109:14 | ... == ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 109 | 109 | -| test.c:109:9:109:14 | ... == ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 113 | 113 | -| test.c:109:9:109:23 | ... \|\| ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 113 | 113 | -| test.c:109:9:109:23 | ... \|\| ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 113 | 113 | -| test.c:109:9:109:23 | ... \|\| ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | 0 | 0 | 113 | 113 | -| test.c:109:9:109:23 | ... \|\| ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | -| test.c:109:19:109:23 | ... < ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | 0 | 0 | 113 | 113 | -| test.c:109:19:109:23 | ... < ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 34 | 34 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 31 | 32 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | != | test.cpp:31:7:31:7 | x | 0 | 30 | 30 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | != | test.cpp:31:7:31:7 | x | 0 | 34 | 34 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 30 | 30 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 31 | 32 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.ql deleted file mode 100644 index 85e5f8376f0e..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/ASTGuardsEnsure.ql +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @name Guards control test - * @description List which guards ensure which inequalities apply to which blocks - * @kind test - */ - -import cpp -import semmle.code.cpp.controlflow.IRGuards - - -from GuardCondition guard, Expr left, Expr right, int k, int start, int end, string op -where -exists(BasicBlock block | - guard.ensuresLt(left, right, k, block, true) and op = "<" - or - guard.ensuresLt(left, right, k, block, false) and op = ">=" - or - guard.ensuresEq(left, right, k, block, true) and op = "==" - or - guard.ensuresEq(left, right, k, block, false) and op = "!=" | - block.hasLocationInfo(_, start, _, end, _) -) -select guard, left, op, right, k, start, end diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected deleted file mode 100644 index 9720f46530de..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.expected +++ /dev/null @@ -1,28 +0,0 @@ -| test.c:7:9:7:13 | ... > ... | -| test.c:17:8:17:12 | ... < ... | -| test.c:17:17:17:21 | ... > ... | -| test.c:26:11:26:15 | ... > ... | -| test.c:34:16:34:21 | ... < ... | -| test.c:42:16:42:21 | ... < ... | -| test.c:44:12:44:16 | ... > ... | -| test.c:45:16:45:20 | ... > ... | -| test.c:58:9:58:14 | ... == ... | -| test.c:58:19:58:23 | ... < ... | -| test.c:75:9:75:14 | ... == ... | -| test.c:85:8:85:13 | ... == ... | -| test.c:85:18:85:23 | ... != ... | -| test.c:94:11:94:16 | ... != ... | -| test.c:102:16:102:21 | ... < ... | -| test.c:109:9:109:14 | ... == ... | -| test.c:109:19:109:23 | ... < ... | -| test.c:126:7:126:7 | 1 | -| test.c:126:12:126:26 | call to test3_condition | -| test.c:131:7:131:7 | b | -| test.c:137:7:137:7 | 0 | -| test.c:138:9:138:9 | i | -| test.c:146:8:146:8 | x | -| test.c:152:10:152:10 | x | -| test.c:152:15:152:15 | y | -| test.cpp:18:8:18:12 | (bool)... | -| test.cpp:31:7:31:13 | ... == ... | -| test.cpp:42:13:42:20 | call to getABool | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.ql deleted file mode 100644 index 9560c9dc79ca..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuards.ql +++ /dev/null @@ -1,5 +0,0 @@ -import cpp -import semmle.code.cpp.controlflow.IRGuards - -from IRGuardCondition guard -select guard.getAST() \ No newline at end of file diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.expected deleted file mode 100644 index d118b0463076..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.expected +++ /dev/null @@ -1,104 +0,0 @@ -| 7 | 0 < x+0 when ... > ... is true | -| 7 | 0 >= x+0 when ... > ... is false | -| 7 | x < 0+1 when ... > ... is false | -| 7 | x >= 0+1 when ... > ... is true | -| 17 | 0 < x+1 when ... < ... is false | -| 17 | 0 >= x+1 when ... < ... is true | -| 17 | 1 < y+0 when ... > ... is true | -| 17 | 1 >= y+0 when ... > ... is false | -| 17 | (long)... < y+0 when ... > ... is true | -| 17 | (long)... >= y+0 when ... > ... is false | -| 17 | x < 0+0 when ... < ... is true | -| 17 | x >= 0+0 when ... < ... is false | -| 17 | y < 1+1 when ... > ... is false | -| 17 | y < (long)...+1 when ... > ... is false | -| 17 | y >= 1+1 when ... > ... is true | -| 17 | y >= (long)...+1 when ... > ... is true | -| 18 | (bool)... != call to get+0 when (bool)... is true | -| 18 | (bool)... != call to get+0 when call to get is true | -| 18 | (bool)... == call to get+0 when (bool)... is false | -| 18 | (bool)... == call to get+0 when call to get is false | -| 18 | call to get != (bool)...+0 when (bool)... is true | -| 18 | call to get != (bool)...+0 when call to get is true | -| 18 | call to get != call to get+0 when (bool)... is true | -| 18 | call to get != call to get+0 when call to get is true | -| 18 | call to get == (bool)...+0 when (bool)... is false | -| 18 | call to get == (bool)...+0 when call to get is false | -| 18 | call to get == call to get+0 when (bool)... is false | -| 18 | call to get == call to get+0 when call to get is false | -| 26 | 0 < x+0 when ... > ... is true | -| 26 | 0 >= x+0 when ... > ... is false | -| 26 | x < 0+1 when ... > ... is false | -| 26 | x >= 0+1 when ... > ... is true | -| 31 | - ... != x+0 when ... == ... is false | -| 31 | - ... == x+0 when ... == ... is true | -| 31 | x != - ...+0 when ... == ... is false | -| 31 | x == - ...+0 when ... == ... is true | -| 34 | 10 < j+1 when ... < ... is false | -| 34 | 10 >= j+1 when ... < ... is true | -| 34 | j < 10+0 when ... < ... is true | -| 34 | j >= 10+0 when ... < ... is false | -| 42 | 10 < j+1 when ... < ... is false | -| 42 | 10 >= j+1 when ... < ... is true | -| 42 | j < 10+0 when ... < ... is true | -| 42 | j >= 10+0 when ... < ... is false | -| 44 | 0 < z+0 when ... > ... is true | -| 44 | 0 >= z+0 when ... > ... is false | -| 44 | z < 0+1 when ... > ... is false | -| 44 | z >= 0+1 when ... > ... is true | -| 45 | 0 < y+0 when ... > ... is true | -| 45 | 0 >= y+0 when ... > ... is false | -| 45 | (long)... < y+0 when ... > ... is true | -| 45 | (long)... >= y+0 when ... > ... is false | -| 45 | y < 0+1 when ... > ... is false | -| 45 | y < (long)...+1 when ... > ... is false | -| 45 | y >= 0+1 when ... > ... is true | -| 45 | y >= (long)...+1 when ... > ... is true | -| 58 | 0 != x+0 when ... == ... is false | -| 58 | 0 < y+1 when ... < ... is false | -| 58 | 0 == x+0 when ... == ... is true | -| 58 | 0 >= y+1 when ... < ... is true | -| 58 | (long)... < y+1 when ... < ... is false | -| 58 | (long)... >= y+1 when ... < ... is true | -| 58 | x != 0+0 when ... == ... is false | -| 58 | x == 0+0 when ... == ... is true | -| 58 | y < 0+0 when ... < ... is true | -| 58 | y < (long)...+0 when ... < ... is true | -| 58 | y >= 0+0 when ... < ... is false | -| 58 | y >= (long)...+0 when ... < ... is false | -| 75 | 0 != x+0 when ... == ... is false | -| 75 | 0 == x+0 when ... == ... is true | -| 75 | x != 0+0 when ... == ... is false | -| 75 | x == 0+0 when ... == ... is true | -| 85 | 0 != x+0 when ... == ... is false | -| 85 | 0 != y+0 when ... != ... is true | -| 85 | 0 == x+0 when ... == ... is true | -| 85 | 0 == y+0 when ... != ... is false | -| 85 | (long)... != y+0 when ... != ... is true | -| 85 | (long)... == y+0 when ... != ... is false | -| 85 | x != 0+0 when ... == ... is false | -| 85 | x == 0+0 when ... == ... is true | -| 85 | y != 0+0 when ... != ... is true | -| 85 | y != (long)...+0 when ... != ... is true | -| 85 | y == 0+0 when ... != ... is false | -| 85 | y == (long)...+0 when ... != ... is false | -| 94 | 0 != x+0 when ... != ... is true | -| 94 | 0 == x+0 when ... != ... is false | -| 94 | x != 0+0 when ... != ... is true | -| 94 | x == 0+0 when ... != ... is false | -| 102 | 10 < j+1 when ... < ... is false | -| 102 | 10 >= j+1 when ... < ... is true | -| 102 | j < 10+0 when ... < ... is true | -| 102 | j >= 10+0 when ... < ... is false | -| 109 | 0 != x+0 when ... == ... is false | -| 109 | 0 < y+1 when ... < ... is false | -| 109 | 0 == x+0 when ... == ... is true | -| 109 | 0 >= y+1 when ... < ... is true | -| 109 | (long)... < y+1 when ... < ... is false | -| 109 | (long)... >= y+1 when ... < ... is true | -| 109 | x != 0+0 when ... == ... is false | -| 109 | x == 0+0 when ... == ... is true | -| 109 | y < 0+0 when ... < ... is true | -| 109 | y < (long)...+0 when ... < ... is true | -| 109 | y >= 0+0 when ... < ... is false | -| 109 | y >= (long)...+0 when ... < ... is false | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.ql deleted file mode 100644 index 4f390935a984..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsCompare.ql +++ /dev/null @@ -1,30 +0,0 @@ -/** - * @name Guards comparison test - * @description List comparison parts. - * @kind test - */ - -import cpp -import semmle.code.cpp.controlflow.IRGuards - -Element clearConversions(Element e) { - if e instanceof Conversion - then result = e.(Conversion).getExpr*() - else result = e -} - -from IRGuardCondition guard, Instruction left, Instruction right, int k, string which, string op, string msg -where -(exists(boolean sense | sense = true and which = "true" or sense = false and which = "false" | - guard.comparesLt(left, right, k, true, sense) and op = " < " - or - guard.comparesLt(left, right, k, false, sense) and op = " >= " - or - guard.comparesEq(left, right, k, true, sense) and op = " == " - or - guard.comparesEq(left, right, k, false, sense) and op = " != " - ) -) -and msg = clearConversions(left.getAST()) + op + clearConversions(right.getAST()) + "+" + k + " when " + clearConversions(guard.getAST()) + " is " + which - -select guard.getLocation().getStartLine(), msg \ No newline at end of file diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected deleted file mode 100644 index 3c96e1eaf84c..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.expected +++ /dev/null @@ -1,88 +0,0 @@ -| test.c:7:9:7:13 | ... > ... | false | 11 | 11 | -| test.c:7:9:7:13 | ... > ... | true | 8 | 8 | -| test.c:17:8:17:12 | ... < ... | true | 17 | 17 | -| test.c:17:8:17:12 | ... < ... | true | 18 | 18 | -| test.c:17:17:17:21 | ... > ... | true | 18 | 18 | -| test.c:26:11:26:15 | ... > ... | false | 2 | 2 | -| test.c:26:11:26:15 | ... > ... | false | 31 | 31 | -| test.c:26:11:26:15 | ... > ... | false | 34 | 34 | -| test.c:26:11:26:15 | ... > ... | false | 35 | 35 | -| test.c:26:11:26:15 | ... > ... | false | 39 | 39 | -| test.c:26:11:26:15 | ... > ... | false | 42 | 42 | -| test.c:26:11:26:15 | ... > ... | false | 43 | 43 | -| test.c:26:11:26:15 | ... > ... | false | 45 | 45 | -| test.c:26:11:26:15 | ... > ... | false | 46 | 46 | -| test.c:26:11:26:15 | ... > ... | false | 49 | 49 | -| test.c:26:11:26:15 | ... > ... | false | 52 | 52 | -| test.c:26:11:26:15 | ... > ... | false | 56 | 56 | -| test.c:26:11:26:15 | ... > ... | false | 58 | 58 | -| test.c:26:11:26:15 | ... > ... | false | 59 | 59 | -| test.c:26:11:26:15 | ... > ... | false | 62 | 62 | -| test.c:26:11:26:15 | ... > ... | true | 27 | 27 | -| test.c:34:16:34:21 | ... < ... | false | 2 | 2 | -| test.c:34:16:34:21 | ... < ... | false | 39 | 39 | -| test.c:34:16:34:21 | ... < ... | false | 42 | 42 | -| test.c:34:16:34:21 | ... < ... | false | 43 | 43 | -| test.c:34:16:34:21 | ... < ... | false | 45 | 45 | -| test.c:34:16:34:21 | ... < ... | false | 46 | 46 | -| test.c:34:16:34:21 | ... < ... | false | 49 | 49 | -| test.c:34:16:34:21 | ... < ... | false | 52 | 52 | -| test.c:34:16:34:21 | ... < ... | false | 56 | 56 | -| test.c:34:16:34:21 | ... < ... | false | 58 | 58 | -| test.c:34:16:34:21 | ... < ... | false | 59 | 59 | -| test.c:34:16:34:21 | ... < ... | false | 62 | 62 | -| test.c:34:16:34:21 | ... < ... | true | 35 | 35 | -| test.c:42:16:42:21 | ... < ... | true | 42 | 42 | -| test.c:42:16:42:21 | ... < ... | true | 43 | 43 | -| test.c:42:16:42:21 | ... < ... | true | 45 | 45 | -| test.c:42:16:42:21 | ... < ... | true | 46 | 46 | -| test.c:42:16:42:21 | ... < ... | true | 49 | 49 | -| test.c:42:16:42:21 | ... < ... | true | 52 | 52 | -| test.c:44:12:44:16 | ... > ... | false | 52 | 52 | -| test.c:44:12:44:16 | ... > ... | true | 45 | 45 | -| test.c:44:12:44:16 | ... > ... | true | 46 | 46 | -| test.c:44:12:44:16 | ... > ... | true | 49 | 49 | -| test.c:45:16:45:20 | ... > ... | false | 49 | 49 | -| test.c:45:16:45:20 | ... > ... | true | 46 | 46 | -| test.c:58:9:58:14 | ... == ... | false | 58 | 58 | -| test.c:58:9:58:14 | ... == ... | false | 62 | 62 | -| test.c:58:19:58:23 | ... < ... | false | 62 | 62 | -| test.c:75:9:75:14 | ... == ... | false | 79 | 79 | -| test.c:75:9:75:14 | ... == ... | true | 76 | 76 | -| test.c:85:8:85:13 | ... == ... | true | 85 | 85 | -| test.c:85:8:85:13 | ... == ... | true | 86 | 86 | -| test.c:85:18:85:23 | ... != ... | true | 86 | 86 | -| test.c:94:11:94:16 | ... != ... | false | 70 | 70 | -| test.c:94:11:94:16 | ... != ... | false | 99 | 99 | -| test.c:94:11:94:16 | ... != ... | false | 102 | 102 | -| test.c:94:11:94:16 | ... != ... | false | 103 | 103 | -| test.c:94:11:94:16 | ... != ... | false | 107 | 107 | -| test.c:94:11:94:16 | ... != ... | false | 109 | 109 | -| test.c:94:11:94:16 | ... != ... | false | 110 | 110 | -| test.c:94:11:94:16 | ... != ... | false | 113 | 113 | -| test.c:94:11:94:16 | ... != ... | true | 95 | 95 | -| test.c:102:16:102:21 | ... < ... | false | 70 | 70 | -| test.c:102:16:102:21 | ... < ... | false | 107 | 107 | -| test.c:102:16:102:21 | ... < ... | false | 109 | 109 | -| test.c:102:16:102:21 | ... < ... | false | 110 | 110 | -| test.c:102:16:102:21 | ... < ... | false | 113 | 113 | -| test.c:102:16:102:21 | ... < ... | true | 103 | 103 | -| test.c:109:9:109:14 | ... == ... | false | 109 | 109 | -| test.c:109:9:109:14 | ... == ... | false | 113 | 113 | -| test.c:109:19:109:23 | ... < ... | false | 113 | 113 | -| test.c:126:7:126:7 | 1 | true | 126 | 126 | -| test.c:126:7:126:7 | 1 | true | 127 | 127 | -| test.c:126:12:126:26 | call to test3_condition | true | 127 | 127 | -| test.c:131:7:131:7 | b | true | 132 | 132 | -| test.c:137:7:137:7 | 0 | true | 138 | 138 | -| test.c:137:7:137:7 | 0 | true | 139 | 139 | -| test.c:138:9:138:9 | i | true | 139 | 139 | -| test.c:146:8:146:8 | x | false | 147 | 147 | -| test.c:152:10:152:10 | x | true | 152 | 152 | -| test.c:152:15:152:15 | y | true | 152 | 152 | -| test.cpp:18:8:18:12 | (bool)... | true | 0 | 0 | -| test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | -| test.cpp:31:7:31:13 | ... == ... | true | 30 | 30 | -| test.cpp:31:7:31:13 | ... == ... | true | 32 | 32 | -| test.cpp:42:13:42:20 | call to getABool | false | 53 | 53 | -| test.cpp:42:13:42:20 | call to getABool | true | 44 | 44 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.ql deleted file mode 100644 index a9864da941c1..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsControl.ql +++ /dev/null @@ -1,16 +0,0 @@ -/** - * @name Guards control test - * @description List which guards control which blocks - * @kind test - */ - -import cpp -import semmle.code.cpp.controlflow.IRGuards - -from IRGuardCondition guard, boolean sense, int start, int end -where -exists(IRBlock block | - guard.controls(block, sense) and - block.getLocation().hasLocationInfo(_, start, _, end, _) -) -select guard.getAST(), sense, start, end diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.expected deleted file mode 100644 index 8788337ccc3b..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.expected +++ /dev/null @@ -1,152 +0,0 @@ -| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | < | test.c:7:13:7:13 | 0 | 1 | 11 | 11 | -| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | >= | test.c:7:13:7:13 | 0 | 1 | 8 | 8 | -| test.c:7:9:7:13 | ... > ... | test.c:7:13:7:13 | 0 | < | test.c:7:9:7:9 | x | 0 | 8 | 8 | -| test.c:7:9:7:13 | ... > ... | test.c:7:13:7:13 | 0 | >= | test.c:7:9:7:9 | x | 0 | 11 | 11 | -| test.c:17:8:17:12 | ... < ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 17 | 17 | -| test.c:17:8:17:12 | ... < ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 18 | 18 | -| test.c:17:8:17:12 | ... < ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 17 | 17 | -| test.c:17:8:17:12 | ... < ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 18 | 18 | -| test.c:17:17:17:21 | ... > ... | test.c:17:17:17:17 | y | >= | test.c:17:21:17:21 | (long)... | 1 | 18 | 18 | -| test.c:17:17:17:21 | ... > ... | test.c:17:21:17:21 | (long)... | < | test.c:17:17:17:17 | y | 0 | 18 | 18 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 2 | 2 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 31 | 31 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 34 | 34 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 35 | 35 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 39 | 39 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 42 | 42 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 43 | 43 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 45 | 45 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 46 | 46 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 49 | 49 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 52 | 52 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 56 | 56 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 58 | 58 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 59 | 59 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 62 | 62 | -| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | >= | test.c:26:15:26:15 | 0 | 1 | 27 | 27 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | < | test.c:26:11:26:11 | x | 0 | 27 | 27 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 2 | 2 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 31 | 31 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 34 | 34 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 35 | 35 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 39 | 39 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 42 | 42 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 43 | 43 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 45 | 45 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 46 | 46 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 49 | 49 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 52 | 52 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 56 | 56 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 58 | 58 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 59 | 59 | -| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 62 | 62 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | < | test.c:34:20:34:21 | 10 | 0 | 35 | 35 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 2 | 2 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 39 | 39 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 42 | 42 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 43 | 43 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 45 | 45 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 46 | 46 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 49 | 49 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 52 | 52 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 56 | 56 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 58 | 58 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 59 | 59 | -| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 62 | 62 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 2 | 2 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 39 | 39 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 42 | 42 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 43 | 43 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 45 | 45 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 46 | 46 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 49 | 49 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 52 | 52 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 56 | 56 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 58 | 58 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 59 | 59 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 62 | 62 | -| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | >= | test.c:34:16:34:16 | j | 1 | 35 | 35 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 42 | 42 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 43 | 43 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 45 | 45 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 46 | 46 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 49 | 49 | -| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 52 | 52 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 42 | 42 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 43 | 43 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 45 | 45 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 46 | 46 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 49 | 49 | -| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 52 | 52 | -| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | < | test.c:44:16:44:16 | 0 | 1 | 52 | 52 | -| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 45 | 45 | -| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 46 | 46 | -| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 49 | 49 | -| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 45 | 45 | -| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 46 | 46 | -| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 49 | 49 | -| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | >= | test.c:44:12:44:12 | z | 0 | 52 | 52 | -| test.c:45:16:45:20 | ... > ... | test.c:45:16:45:16 | y | < | test.c:45:20:45:20 | (long)... | 1 | 49 | 49 | -| test.c:45:16:45:20 | ... > ... | test.c:45:16:45:16 | y | >= | test.c:45:20:45:20 | (long)... | 1 | 46 | 46 | -| test.c:45:16:45:20 | ... > ... | test.c:45:20:45:20 | (long)... | < | test.c:45:16:45:16 | y | 0 | 46 | 46 | -| test.c:45:16:45:20 | ... > ... | test.c:45:20:45:20 | (long)... | >= | test.c:45:16:45:16 | y | 0 | 49 | 49 | -| test.c:58:9:58:14 | ... == ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 58 | 58 | -| test.c:58:9:58:14 | ... == ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 62 | 62 | -| test.c:58:9:58:14 | ... == ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 58 | 58 | -| test.c:58:9:58:14 | ... == ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 62 | 62 | -| test.c:58:19:58:23 | ... < ... | test.c:58:19:58:19 | y | >= | test.c:58:23:58:23 | (long)... | 0 | 62 | 62 | -| test.c:58:19:58:23 | ... < ... | test.c:58:23:58:23 | (long)... | < | test.c:58:19:58:19 | y | 1 | 62 | 62 | -| test.c:75:9:75:14 | ... == ... | test.c:75:9:75:9 | x | != | test.c:75:14:75:14 | 0 | 0 | 79 | 79 | -| test.c:75:9:75:14 | ... == ... | test.c:75:9:75:9 | x | == | test.c:75:14:75:14 | 0 | 0 | 76 | 76 | -| test.c:75:9:75:14 | ... == ... | test.c:75:14:75:14 | 0 | != | test.c:75:9:75:9 | x | 0 | 79 | 79 | -| test.c:75:9:75:14 | ... == ... | test.c:75:14:75:14 | 0 | == | test.c:75:9:75:9 | x | 0 | 76 | 76 | -| test.c:85:8:85:13 | ... == ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 85 | 85 | -| test.c:85:8:85:13 | ... == ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 86 | 86 | -| test.c:85:8:85:13 | ... == ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 85 | 85 | -| test.c:85:8:85:13 | ... == ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 86 | 86 | -| test.c:85:18:85:23 | ... != ... | test.c:85:18:85:18 | y | != | test.c:85:23:85:23 | (long)... | 0 | 86 | 86 | -| test.c:85:18:85:23 | ... != ... | test.c:85:23:85:23 | (long)... | != | test.c:85:18:85:18 | y | 0 | 86 | 86 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | != | test.c:94:16:94:16 | 0 | 0 | 95 | 95 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 70 | 70 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 99 | 99 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 102 | 102 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 103 | 103 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 107 | 107 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 109 | 109 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 110 | 110 | -| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 113 | 113 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | != | test.c:94:11:94:11 | x | 0 | 95 | 95 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 70 | 70 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 99 | 99 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 102 | 102 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 103 | 103 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 107 | 107 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 109 | 109 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 110 | 110 | -| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 113 | 113 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | < | test.c:102:20:102:21 | 10 | 0 | 103 | 103 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 70 | 70 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 107 | 107 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 109 | 109 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 110 | 110 | -| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 113 | 113 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 70 | 70 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 107 | 107 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 109 | 109 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 110 | 110 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 113 | 113 | -| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | >= | test.c:102:16:102:16 | j | 1 | 103 | 103 | -| test.c:109:9:109:14 | ... == ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 109 | 109 | -| test.c:109:9:109:14 | ... == ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 113 | 113 | -| test.c:109:9:109:14 | ... == ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 109 | 109 | -| test.c:109:9:109:14 | ... == ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 113 | 113 | -| test.c:109:19:109:23 | ... < ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | (long)... | 0 | 113 | 113 | -| test.c:109:19:109:23 | ... < ... | test.c:109:23:109:23 | (long)... | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | -| test.cpp:18:8:18:12 | (bool)... | test.cpp:18:8:18:10 | call to get | != | test.cpp:18:8:18:12 | (bool)... | 0 | 0 | 0 | -| test.cpp:18:8:18:12 | (bool)... | test.cpp:18:8:18:12 | (bool)... | != | test.cpp:18:8:18:10 | call to get | 0 | 0 | 0 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 34 | 34 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 32 | 32 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | != | test.cpp:31:7:31:7 | x | 0 | 34 | 34 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 30 | 30 | -| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 32 | 32 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.ql deleted file mode 100644 index a13d4cf2a42e..000000000000 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/IRGuardsEnsure.ql +++ /dev/null @@ -1,23 +0,0 @@ -/** - * @name Guards control test - * @description List which guards ensure which inequalities apply to which blocks - * @kind test - */ - -import cpp -import semmle.code.cpp.controlflow.IRGuards - - -from IRGuardCondition guard, Instruction left, Instruction right, int k, int start, int end, string op -where -exists(IRBlock block | - guard.ensuresLt(left, right, k, block, true) and op = "<" - or - guard.ensuresLt(left, right, k, block, false) and op = ">=" - or - guard.ensuresEq(left, right, k, block, true) and op = "==" - or - guard.ensuresEq(left, right, k, block, false) and op = "!=" | - block.getLocation().hasLocationInfo(_, start, _, end, _) -) -select guard.getAST(), left.getAST(), op, right.getAST(), k, start, end diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected new file mode 100644 index 000000000000..07661aaf3206 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected @@ -0,0 +1,730 @@ +astGuards +| test.c:7:9:7:13 | ... > ... | +| test.c:17:8:17:12 | ... < ... | +| test.c:17:8:17:21 | ... && ... | +| test.c:17:17:17:21 | ... > ... | +| test.c:26:11:26:15 | ... > ... | +| test.c:34:16:34:21 | ... < ... | +| test.c:42:16:42:21 | ... < ... | +| test.c:44:12:44:16 | ... > ... | +| test.c:45:16:45:20 | ... > ... | +| test.c:58:9:58:14 | ... == ... | +| test.c:58:9:58:23 | ... \|\| ... | +| test.c:58:19:58:23 | ... < ... | +| test.c:75:9:75:14 | ... == ... | +| test.c:85:8:85:13 | ... == ... | +| test.c:85:8:85:23 | ... && ... | +| test.c:85:18:85:23 | ... != ... | +| test.c:94:11:94:16 | ... != ... | +| test.c:102:16:102:21 | ... < ... | +| test.c:109:9:109:14 | ... == ... | +| test.c:109:9:109:23 | ... \|\| ... | +| test.c:109:19:109:23 | ... < ... | +| test.c:126:7:126:7 | 1 | +| test.c:126:7:126:28 | ... && ... | +| test.c:126:12:126:26 | call to test3_condition | +| test.c:131:7:131:7 | b | +| test.c:137:7:137:7 | 0 | +| test.c:138:9:138:9 | i | +| test.c:146:7:146:8 | ! ... | +| test.c:146:8:146:8 | x | +| test.c:152:10:152:10 | x | +| test.c:152:10:152:15 | ... && ... | +| test.c:152:15:152:15 | y | +| test.cpp:18:8:18:10 | call to get | +| test.cpp:31:7:31:13 | ... == ... | +| test.cpp:42:13:42:20 | call to getABool | +astGuardsCompare +| 7 | 0 < x+0 when ... > ... is true | +| 7 | 0 >= x+0 when ... > ... is false | +| 7 | x < 0+1 when ... > ... is false | +| 7 | x >= 0+1 when ... > ... is true | +| 17 | 0 < x+1 when ... < ... is false | +| 17 | 0 >= x+1 when ... && ... is true | +| 17 | 0 >= x+1 when ... < ... is true | +| 17 | 1 < y+0 when ... && ... is true | +| 17 | 1 < y+0 when ... > ... is true | +| 17 | 1 >= y+0 when ... > ... is false | +| 17 | x < 0+0 when ... && ... is true | +| 17 | x < 0+0 when ... < ... is true | +| 17 | x >= 0+0 when ... < ... is false | +| 17 | y < 1+1 when ... > ... is false | +| 17 | y >= 1+1 when ... && ... is true | +| 17 | y >= 1+1 when ... > ... is true | +| 26 | 0 < x+0 when ... > ... is true | +| 26 | 0 >= x+0 when ... > ... is false | +| 26 | x < 0+1 when ... > ... is false | +| 26 | x >= 0+1 when ... > ... is true | +| 31 | - ... != x+0 when ... == ... is false | +| 31 | - ... == x+0 when ... == ... is true | +| 31 | x != - ...+0 when ... == ... is false | +| 31 | x == - ...+0 when ... == ... is true | +| 34 | 10 < j+1 when ... < ... is false | +| 34 | 10 >= j+1 when ... < ... is true | +| 34 | j < 10+0 when ... < ... is true | +| 34 | j >= 10+0 when ... < ... is false | +| 42 | 10 < j+1 when ... < ... is false | +| 42 | 10 >= j+1 when ... < ... is true | +| 42 | j < 10+0 when ... < ... is true | +| 42 | j >= 10+0 when ... < ... is false | +| 44 | 0 < z+0 when ... > ... is true | +| 44 | 0 >= z+0 when ... > ... is false | +| 44 | z < 0+1 when ... > ... is false | +| 44 | z >= 0+1 when ... > ... is true | +| 45 | 0 < y+0 when ... > ... is true | +| 45 | 0 >= y+0 when ... > ... is false | +| 45 | y < 0+1 when ... > ... is false | +| 45 | y >= 0+1 when ... > ... is true | +| 58 | 0 != x+0 when ... == ... is false | +| 58 | 0 != x+0 when ... \|\| ... is false | +| 58 | 0 < y+1 when ... < ... is false | +| 58 | 0 < y+1 when ... \|\| ... is false | +| 58 | 0 == x+0 when ... == ... is true | +| 58 | 0 >= y+1 when ... < ... is true | +| 58 | x != 0+0 when ... == ... is false | +| 58 | x != 0+0 when ... \|\| ... is false | +| 58 | x == 0+0 when ... == ... is true | +| 58 | y < 0+0 when ... < ... is true | +| 58 | y >= 0+0 when ... < ... is false | +| 58 | y >= 0+0 when ... \|\| ... is false | +| 75 | 0 != x+0 when ... == ... is false | +| 75 | 0 == x+0 when ... == ... is true | +| 75 | x != 0+0 when ... == ... is false | +| 75 | x == 0+0 when ... == ... is true | +| 85 | 0 != x+0 when ... == ... is false | +| 85 | 0 != y+0 when ... != ... is true | +| 85 | 0 != y+0 when ... && ... is true | +| 85 | 0 == x+0 when ... && ... is true | +| 85 | 0 == x+0 when ... == ... is true | +| 85 | 0 == y+0 when ... != ... is false | +| 85 | x != 0+0 when ... == ... is false | +| 85 | x == 0+0 when ... && ... is true | +| 85 | x == 0+0 when ... == ... is true | +| 85 | y != 0+0 when ... != ... is true | +| 85 | y != 0+0 when ... && ... is true | +| 85 | y == 0+0 when ... != ... is false | +| 94 | 0 != x+0 when ... != ... is true | +| 94 | 0 == x+0 when ... != ... is false | +| 94 | x != 0+0 when ... != ... is true | +| 94 | x == 0+0 when ... != ... is false | +| 102 | 10 < j+1 when ... < ... is false | +| 102 | 10 >= j+1 when ... < ... is true | +| 102 | j < 10+0 when ... < ... is true | +| 102 | j >= 10+0 when ... < ... is false | +| 109 | 0 != x+0 when ... == ... is false | +| 109 | 0 != x+0 when ... \|\| ... is false | +| 109 | 0 < y+1 when ... < ... is false | +| 109 | 0 < y+1 when ... \|\| ... is false | +| 109 | 0 == x+0 when ... == ... is true | +| 109 | 0 >= y+1 when ... < ... is true | +| 109 | x != 0+0 when ... == ... is false | +| 109 | x != 0+0 when ... \|\| ... is false | +| 109 | x == 0+0 when ... == ... is true | +| 109 | y < 0+0 when ... < ... is true | +| 109 | y >= 0+0 when ... < ... is false | +| 109 | y >= 0+0 when ... \|\| ... is false | +astGuardsControl +| test.c:7:9:7:13 | ... > ... | false | 10 | 11 | +| test.c:7:9:7:13 | ... > ... | true | 7 | 9 | +| test.c:17:8:17:12 | ... < ... | true | 17 | 17 | +| test.c:17:8:17:12 | ... < ... | true | 18 | 18 | +| test.c:17:8:17:21 | ... && ... | true | 18 | 18 | +| test.c:17:17:17:21 | ... > ... | true | 18 | 18 | +| test.c:26:11:26:15 | ... > ... | false | 2 | 2 | +| test.c:26:11:26:15 | ... > ... | false | 31 | 34 | +| test.c:26:11:26:15 | ... > ... | false | 34 | 34 | +| test.c:26:11:26:15 | ... > ... | false | 39 | 42 | +| test.c:26:11:26:15 | ... > ... | false | 42 | 42 | +| test.c:26:11:26:15 | ... > ... | false | 42 | 44 | +| test.c:26:11:26:15 | ... > ... | false | 45 | 45 | +| test.c:26:11:26:15 | ... > ... | false | 45 | 47 | +| test.c:26:11:26:15 | ... > ... | false | 48 | 55 | +| test.c:26:11:26:15 | ... > ... | false | 51 | 53 | +| test.c:26:11:26:15 | ... > ... | false | 56 | 58 | +| test.c:26:11:26:15 | ... > ... | false | 58 | 58 | +| test.c:26:11:26:15 | ... > ... | false | 58 | 66 | +| test.c:26:11:26:15 | ... > ... | false | 62 | 62 | +| test.c:26:11:26:15 | ... > ... | true | 26 | 28 | +| test.c:34:16:34:21 | ... < ... | false | 2 | 2 | +| test.c:34:16:34:21 | ... < ... | false | 39 | 42 | +| test.c:34:16:34:21 | ... < ... | false | 42 | 42 | +| test.c:34:16:34:21 | ... < ... | false | 42 | 44 | +| test.c:34:16:34:21 | ... < ... | false | 45 | 45 | +| test.c:34:16:34:21 | ... < ... | false | 45 | 47 | +| test.c:34:16:34:21 | ... < ... | false | 48 | 55 | +| test.c:34:16:34:21 | ... < ... | false | 51 | 53 | +| test.c:34:16:34:21 | ... < ... | false | 56 | 58 | +| test.c:34:16:34:21 | ... < ... | false | 58 | 58 | +| test.c:34:16:34:21 | ... < ... | false | 58 | 66 | +| test.c:34:16:34:21 | ... < ... | false | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | true | 34 | 34 | +| test.c:42:16:42:21 | ... < ... | true | 42 | 42 | +| test.c:42:16:42:21 | ... < ... | true | 42 | 44 | +| test.c:42:16:42:21 | ... < ... | true | 45 | 45 | +| test.c:42:16:42:21 | ... < ... | true | 45 | 47 | +| test.c:42:16:42:21 | ... < ... | true | 48 | 55 | +| test.c:42:16:42:21 | ... < ... | true | 51 | 53 | +| test.c:44:12:44:16 | ... > ... | false | 51 | 53 | +| test.c:44:12:44:16 | ... > ... | true | 45 | 45 | +| test.c:44:12:44:16 | ... > ... | true | 45 | 47 | +| test.c:44:12:44:16 | ... > ... | true | 48 | 55 | +| test.c:45:16:45:20 | ... > ... | false | 48 | 55 | +| test.c:45:16:45:20 | ... > ... | true | 45 | 47 | +| test.c:58:9:58:14 | ... == ... | false | 58 | 58 | +| test.c:58:9:58:14 | ... == ... | false | 62 | 62 | +| test.c:58:9:58:23 | ... \|\| ... | false | 62 | 62 | +| test.c:58:19:58:23 | ... < ... | false | 62 | 62 | +| test.c:75:9:75:14 | ... == ... | false | 78 | 79 | +| test.c:75:9:75:14 | ... == ... | true | 75 | 77 | +| test.c:85:8:85:13 | ... == ... | true | 85 | 85 | +| test.c:85:8:85:13 | ... == ... | true | 86 | 86 | +| test.c:85:8:85:23 | ... && ... | true | 86 | 86 | +| test.c:85:18:85:23 | ... != ... | true | 86 | 86 | +| test.c:94:11:94:16 | ... != ... | false | 70 | 70 | +| test.c:94:11:94:16 | ... != ... | false | 99 | 102 | +| test.c:94:11:94:16 | ... != ... | false | 102 | 102 | +| test.c:94:11:94:16 | ... != ... | false | 107 | 109 | +| test.c:94:11:94:16 | ... != ... | false | 109 | 109 | +| test.c:94:11:94:16 | ... != ... | false | 109 | 117 | +| test.c:94:11:94:16 | ... != ... | false | 113 | 113 | +| test.c:94:11:94:16 | ... != ... | true | 94 | 96 | +| test.c:102:16:102:21 | ... < ... | false | 70 | 70 | +| test.c:102:16:102:21 | ... < ... | false | 107 | 109 | +| test.c:102:16:102:21 | ... < ... | false | 109 | 109 | +| test.c:102:16:102:21 | ... < ... | false | 109 | 117 | +| test.c:102:16:102:21 | ... < ... | false | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | true | 102 | 102 | +| test.c:109:9:109:14 | ... == ... | false | 109 | 109 | +| test.c:109:9:109:14 | ... == ... | false | 113 | 113 | +| test.c:109:9:109:23 | ... \|\| ... | false | 113 | 113 | +| test.c:109:19:109:23 | ... < ... | false | 113 | 113 | +| test.c:126:7:126:7 | 1 | true | 126 | 126 | +| test.c:126:7:126:7 | 1 | true | 126 | 128 | +| test.c:126:7:126:28 | ... && ... | true | 126 | 128 | +| test.c:126:12:126:26 | call to test3_condition | true | 126 | 128 | +| test.c:131:7:131:7 | b | true | 131 | 132 | +| test.c:137:7:137:7 | 0 | true | 137 | 138 | +| test.c:137:7:137:7 | 0 | true | 138 | 139 | +| test.c:138:9:138:9 | i | true | 138 | 139 | +| test.c:146:7:146:8 | ! ... | true | 146 | 147 | +| test.c:146:8:146:8 | x | false | 146 | 147 | +| test.c:152:10:152:10 | x | true | 151 | 152 | +| test.c:152:10:152:10 | x | true | 152 | 152 | +| test.c:152:10:152:15 | ... && ... | true | 151 | 152 | +| test.c:152:15:152:15 | y | true | 151 | 152 | +| test.cpp:18:8:18:10 | call to get | true | 19 | 19 | +| test.cpp:31:7:31:13 | ... == ... | false | 30 | 30 | +| test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | true | 30 | 30 | +| test.cpp:31:7:31:13 | ... == ... | true | 31 | 32 | +| test.cpp:42:13:42:20 | call to getABool | false | 53 | 53 | +| test.cpp:42:13:42:20 | call to getABool | true | 43 | 45 | +astGuardsEnsure +| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | < | test.c:7:13:7:13 | 0 | 1 | 10 | 11 | +| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | >= | test.c:7:13:7:13 | 0 | 1 | 7 | 9 | +| test.c:7:9:7:13 | ... > ... | test.c:7:13:7:13 | 0 | < | test.c:7:9:7:9 | x | 0 | 7 | 9 | +| test.c:7:9:7:13 | ... > ... | test.c:7:13:7:13 | 0 | >= | test.c:7:9:7:9 | x | 0 | 10 | 11 | +| test.c:17:8:17:12 | ... < ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 17 | 17 | +| test.c:17:8:17:12 | ... < ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 18 | 18 | +| test.c:17:8:17:12 | ... < ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 17 | 17 | +| test.c:17:8:17:12 | ... < ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 18 | 18 | +| test.c:17:8:17:21 | ... && ... | test.c:17:8:17:8 | x | < | test.c:17:12:17:12 | 0 | 0 | 18 | 18 | +| test.c:17:8:17:21 | ... && ... | test.c:17:12:17:12 | 0 | >= | test.c:17:8:17:8 | x | 1 | 18 | 18 | +| test.c:17:8:17:21 | ... && ... | test.c:17:17:17:17 | y | >= | test.c:17:21:17:21 | 1 | 1 | 18 | 18 | +| test.c:17:8:17:21 | ... && ... | test.c:17:21:17:21 | 1 | < | test.c:17:17:17:17 | y | 0 | 18 | 18 | +| test.c:17:17:17:21 | ... > ... | test.c:17:17:17:17 | y | >= | test.c:17:21:17:21 | 1 | 1 | 18 | 18 | +| test.c:17:17:17:21 | ... > ... | test.c:17:21:17:21 | 1 | < | test.c:17:17:17:17 | y | 0 | 18 | 18 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 2 | 2 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 31 | 34 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 34 | 34 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 39 | 42 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 42 | 42 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 42 | 44 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 45 | 45 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 45 | 47 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 48 | 55 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 51 | 53 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 56 | 58 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 58 | 58 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 58 | 66 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | < | test.c:26:15:26:15 | 0 | 1 | 62 | 62 | +| test.c:26:11:26:15 | ... > ... | test.c:26:11:26:11 | x | >= | test.c:26:15:26:15 | 0 | 1 | 26 | 28 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | < | test.c:26:11:26:11 | x | 0 | 26 | 28 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 2 | 2 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 31 | 34 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 34 | 34 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 39 | 42 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 42 | 42 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 42 | 44 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 45 | 45 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 45 | 47 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 48 | 55 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 51 | 53 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 56 | 58 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 58 | 58 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 58 | 66 | +| test.c:26:11:26:15 | ... > ... | test.c:26:15:26:15 | 0 | >= | test.c:26:11:26:11 | x | 0 | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | < | test.c:34:20:34:21 | 10 | 0 | 34 | 34 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 2 | 2 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 39 | 42 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 42 | 42 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 42 | 44 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 45 | 45 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 45 | 47 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 48 | 55 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 51 | 53 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 56 | 58 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 58 | 58 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 58 | 66 | +| test.c:34:16:34:21 | ... < ... | test.c:34:16:34:16 | j | >= | test.c:34:20:34:21 | 10 | 0 | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 2 | 2 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 39 | 42 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 42 | 42 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 42 | 44 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 45 | 45 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 45 | 47 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 48 | 55 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 51 | 53 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 56 | 58 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 58 | 58 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 58 | 66 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | < | test.c:34:16:34:16 | j | 1 | 62 | 62 | +| test.c:34:16:34:21 | ... < ... | test.c:34:20:34:21 | 10 | >= | test.c:34:16:34:16 | j | 1 | 34 | 34 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 42 | 42 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 42 | 44 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 45 | 45 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 45 | 47 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 48 | 55 | +| test.c:42:16:42:21 | ... < ... | test.c:42:16:42:16 | j | < | test.c:42:20:42:21 | 10 | 0 | 51 | 53 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 42 | 42 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 42 | 44 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 45 | 45 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 45 | 47 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 48 | 55 | +| test.c:42:16:42:21 | ... < ... | test.c:42:20:42:21 | 10 | >= | test.c:42:16:42:16 | j | 1 | 51 | 53 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | < | test.c:44:16:44:16 | 0 | 1 | 51 | 53 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 45 | 45 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 45 | 47 | +| test.c:44:12:44:16 | ... > ... | test.c:44:12:44:12 | z | >= | test.c:44:16:44:16 | 0 | 1 | 48 | 55 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 45 | 45 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 45 | 47 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | < | test.c:44:12:44:12 | z | 0 | 48 | 55 | +| test.c:44:12:44:16 | ... > ... | test.c:44:16:44:16 | 0 | >= | test.c:44:12:44:12 | z | 0 | 51 | 53 | +| test.c:45:16:45:20 | ... > ... | test.c:45:16:45:16 | y | < | test.c:45:20:45:20 | 0 | 1 | 48 | 55 | +| test.c:45:16:45:20 | ... > ... | test.c:45:16:45:16 | y | >= | test.c:45:20:45:20 | 0 | 1 | 45 | 47 | +| test.c:45:16:45:20 | ... > ... | test.c:45:20:45:20 | 0 | < | test.c:45:16:45:16 | y | 0 | 45 | 47 | +| test.c:45:16:45:20 | ... > ... | test.c:45:20:45:20 | 0 | >= | test.c:45:16:45:16 | y | 0 | 48 | 55 | +| test.c:58:9:58:14 | ... == ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 58 | 58 | +| test.c:58:9:58:14 | ... == ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 62 | 62 | +| test.c:58:9:58:14 | ... == ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 58 | 58 | +| test.c:58:9:58:14 | ... == ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 62 | 62 | +| test.c:58:9:58:23 | ... \|\| ... | test.c:58:9:58:9 | x | != | test.c:58:14:58:14 | 0 | 0 | 62 | 62 | +| test.c:58:9:58:23 | ... \|\| ... | test.c:58:14:58:14 | 0 | != | test.c:58:9:58:9 | x | 0 | 62 | 62 | +| test.c:58:9:58:23 | ... \|\| ... | test.c:58:19:58:19 | y | >= | test.c:58:23:58:23 | 0 | 0 | 62 | 62 | +| test.c:58:9:58:23 | ... \|\| ... | test.c:58:23:58:23 | 0 | < | test.c:58:19:58:19 | y | 1 | 62 | 62 | +| test.c:58:19:58:23 | ... < ... | test.c:58:19:58:19 | y | >= | test.c:58:23:58:23 | 0 | 0 | 62 | 62 | +| test.c:58:19:58:23 | ... < ... | test.c:58:23:58:23 | 0 | < | test.c:58:19:58:19 | y | 1 | 62 | 62 | +| test.c:75:9:75:14 | ... == ... | test.c:75:9:75:9 | x | != | test.c:75:14:75:14 | 0 | 0 | 78 | 79 | +| test.c:75:9:75:14 | ... == ... | test.c:75:9:75:9 | x | == | test.c:75:14:75:14 | 0 | 0 | 75 | 77 | +| test.c:75:9:75:14 | ... == ... | test.c:75:14:75:14 | 0 | != | test.c:75:9:75:9 | x | 0 | 78 | 79 | +| test.c:75:9:75:14 | ... == ... | test.c:75:14:75:14 | 0 | == | test.c:75:9:75:9 | x | 0 | 75 | 77 | +| test.c:85:8:85:13 | ... == ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 85 | 85 | +| test.c:85:8:85:13 | ... == ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 86 | 86 | +| test.c:85:8:85:13 | ... == ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 85 | 85 | +| test.c:85:8:85:13 | ... == ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 86 | 86 | +| test.c:85:8:85:23 | ... && ... | test.c:85:8:85:8 | x | == | test.c:85:13:85:13 | 0 | 0 | 86 | 86 | +| test.c:85:8:85:23 | ... && ... | test.c:85:13:85:13 | 0 | == | test.c:85:8:85:8 | x | 0 | 86 | 86 | +| test.c:85:8:85:23 | ... && ... | test.c:85:18:85:18 | y | != | test.c:85:23:85:23 | 0 | 0 | 86 | 86 | +| test.c:85:8:85:23 | ... && ... | test.c:85:23:85:23 | 0 | != | test.c:85:18:85:18 | y | 0 | 86 | 86 | +| test.c:85:18:85:23 | ... != ... | test.c:85:18:85:18 | y | != | test.c:85:23:85:23 | 0 | 0 | 86 | 86 | +| test.c:85:18:85:23 | ... != ... | test.c:85:23:85:23 | 0 | != | test.c:85:18:85:18 | y | 0 | 86 | 86 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | != | test.c:94:16:94:16 | 0 | 0 | 94 | 96 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 70 | 70 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 99 | 102 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 102 | 102 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 107 | 109 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 109 | 109 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 109 | 117 | +| test.c:94:11:94:16 | ... != ... | test.c:94:11:94:11 | x | == | test.c:94:16:94:16 | 0 | 0 | 113 | 113 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | != | test.c:94:11:94:11 | x | 0 | 94 | 96 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 70 | 70 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 99 | 102 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 102 | 102 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 107 | 109 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 109 | 109 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 109 | 117 | +| test.c:94:11:94:16 | ... != ... | test.c:94:16:94:16 | 0 | == | test.c:94:11:94:11 | x | 0 | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | < | test.c:102:20:102:21 | 10 | 0 | 102 | 102 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 70 | 70 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 107 | 109 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 109 | 109 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 109 | 117 | +| test.c:102:16:102:21 | ... < ... | test.c:102:16:102:16 | j | >= | test.c:102:20:102:21 | 10 | 0 | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 70 | 70 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 107 | 109 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 109 | 109 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 109 | 117 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | < | test.c:102:16:102:16 | j | 1 | 113 | 113 | +| test.c:102:16:102:21 | ... < ... | test.c:102:20:102:21 | 10 | >= | test.c:102:16:102:16 | j | 1 | 102 | 102 | +| test.c:109:9:109:14 | ... == ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 109 | 109 | +| test.c:109:9:109:14 | ... == ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 113 | 113 | +| test.c:109:9:109:14 | ... == ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 109 | 109 | +| test.c:109:9:109:14 | ... == ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 113 | 113 | +| test.c:109:9:109:23 | ... \|\| ... | test.c:109:9:109:9 | x | != | test.c:109:14:109:14 | 0 | 0 | 113 | 113 | +| test.c:109:9:109:23 | ... \|\| ... | test.c:109:14:109:14 | 0 | != | test.c:109:9:109:9 | x | 0 | 113 | 113 | +| test.c:109:9:109:23 | ... \|\| ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | 0 | 0 | 113 | 113 | +| test.c:109:9:109:23 | ... \|\| ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | +| test.c:109:19:109:23 | ... < ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | 0 | 0 | 113 | 113 | +| test.c:109:19:109:23 | ... < ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 31 | 32 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | != | test.cpp:31:7:31:7 | x | 0 | 30 | 30 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | != | test.cpp:31:7:31:7 | x | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 30 | 30 | +| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 31 | 32 | +irGuards +| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | +| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | +| test.c:17:17:17:21 | r17_3(int) = CompareGT r17_1, r17_2 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | +| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | +| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | +| test.c:58:19:58:23 | r11_3(int) = CompareLT r11_1, r11_2 | +| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | +| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | +| test.c:85:18:85:23 | r9_3(int) = CompareNE r9_1, r9_2 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | +| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | +| test.c:109:19:109:23 | r3_3(int) = CompareLT r3_1, r3_2 | +| test.c:126:7:126:7 | r0_5(int) = Constant[1] | +| test.c:126:12:126:26 | r1_1(int) = Call r1_0 | +| test.c:131:7:131:7 | r3_2(int) = Load r3_1, m3_0 | +| test.c:137:7:137:7 | r0_4(int) = Constant[0] | +| test.c:138:9:138:9 | r1_1(int) = Load r1_0, m0_3 | +| test.c:146:8:146:8 | r0_5(int) = Load r0_4, m0_3 | +| test.c:152:10:152:10 | r0_7(int) = Load r0_6, m0_3 | +| test.c:152:15:152:15 | r1_1(int) = Load r1_0, m0_5 | +| test.cpp:18:8:18:12 | r0_7(bool) = CompareNE r0_5, r0_6 | +| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | +| test.cpp:42:13:42:20 | r0_5(bool) = Call r0_4 | +irGuardsCompare +| 7 | 0 < x+0 when r0_16(int) = CompareGT r0_14, r0_15 is true | +| 7 | 0 >= x+0 when r0_16(int) = CompareGT r0_14, r0_15 is false | +| 7 | x < 0+1 when r0_16(int) = CompareGT r0_14, r0_15 is false | +| 7 | x >= 0+1 when r0_16(int) = CompareGT r0_14, r0_15 is true | +| 17 | 0 < x+1 when r16_13(int) = CompareLT r16_11, r16_12 is false | +| 17 | 0 >= x+1 when r16_13(int) = CompareLT r16_11, r16_12 is true | +| 17 | 1 < y+0 when r17_3(int) = CompareGT r17_1, r17_2 is true | +| 17 | 1 >= y+0 when r17_3(int) = CompareGT r17_1, r17_2 is false | +| 17 | x < 0+0 when r16_13(int) = CompareLT r16_11, r16_12 is true | +| 17 | x >= 0+0 when r16_13(int) = CompareLT r16_11, r16_12 is false | +| 17 | y < 1+1 when r17_3(int) = CompareGT r17_1, r17_2 is false | +| 17 | y >= 1+1 when r17_3(int) = CompareGT r17_1, r17_2 is true | +| 26 | 0 < x+0 when r21_5(int) = CompareGT r21_3, r21_4 is true | +| 26 | 0 >= x+0 when r21_5(int) = CompareGT r21_3, r21_4 is false | +| 26 | x < 0+1 when r21_5(int) = CompareGT r21_3, r21_4 is false | +| 26 | x >= 0+1 when r21_5(int) = CompareGT r21_3, r21_4 is true | +| 31 | - ... != x+0 when r0_7(bool) = CompareEQ r0_5, r0_6 is false | +| 31 | - ... == x+0 when r0_7(bool) = CompareEQ r0_5, r0_6 is true | +| 31 | x != - ...+0 when r0_7(bool) = CompareEQ r0_5, r0_6 is false | +| 31 | x == - ...+0 when r0_7(bool) = CompareEQ r0_5, r0_6 is true | +| 34 | 10 < j+1 when r24_6(int) = CompareLT r24_4, r24_5 is false | +| 34 | 10 >= j+1 when r24_6(int) = CompareLT r24_4, r24_5 is true | +| 34 | j < 10+0 when r24_6(int) = CompareLT r24_4, r24_5 is true | +| 34 | j >= 10+0 when r24_6(int) = CompareLT r24_4, r24_5 is false | +| 42 | 10 < j+1 when r3_6(int) = CompareLT r3_4, r3_5 is false | +| 42 | 10 >= j+1 when r3_6(int) = CompareLT r3_4, r3_5 is true | +| 42 | j < 10+0 when r3_6(int) = CompareLT r3_4, r3_5 is true | +| 42 | j >= 10+0 when r3_6(int) = CompareLT r3_4, r3_5 is false | +| 44 | 0 < z+0 when r4_6(int) = CompareGT r4_4, r4_5 is true | +| 44 | 0 >= z+0 when r4_6(int) = CompareGT r4_4, r4_5 is false | +| 44 | z < 0+1 when r4_6(int) = CompareGT r4_4, r4_5 is false | +| 44 | z >= 0+1 when r4_6(int) = CompareGT r4_4, r4_5 is true | +| 45 | 0 < y+0 when r5_3(int) = CompareGT r5_1, r5_2 is true | +| 45 | 0 >= y+0 when r5_3(int) = CompareGT r5_1, r5_2 is false | +| 45 | y < 0+1 when r5_3(int) = CompareGT r5_1, r5_2 is false | +| 45 | y >= 0+1 when r5_3(int) = CompareGT r5_1, r5_2 is true | +| 58 | 0 != x+0 when r10_5(int) = CompareEQ r10_3, r10_4 is false | +| 58 | 0 < y+1 when r11_3(int) = CompareLT r11_1, r11_2 is false | +| 58 | 0 == x+0 when r10_5(int) = CompareEQ r10_3, r10_4 is true | +| 58 | 0 >= y+1 when r11_3(int) = CompareLT r11_1, r11_2 is true | +| 58 | x != 0+0 when r10_5(int) = CompareEQ r10_3, r10_4 is false | +| 58 | x == 0+0 when r10_5(int) = CompareEQ r10_3, r10_4 is true | +| 58 | y < 0+0 when r11_3(int) = CompareLT r11_1, r11_2 is true | +| 58 | y >= 0+0 when r11_3(int) = CompareLT r11_1, r11_2 is false | +| 75 | 0 != x+0 when r0_16(int) = CompareEQ r0_14, r0_15 is false | +| 75 | 0 == x+0 when r0_16(int) = CompareEQ r0_14, r0_15 is true | +| 75 | x != 0+0 when r0_16(int) = CompareEQ r0_14, r0_15 is false | +| 75 | x == 0+0 when r0_16(int) = CompareEQ r0_14, r0_15 is true | +| 85 | 0 != x+0 when r8_13(int) = CompareEQ r8_11, r8_12 is false | +| 85 | 0 != y+0 when r9_3(int) = CompareNE r9_1, r9_2 is true | +| 85 | 0 == x+0 when r8_13(int) = CompareEQ r8_11, r8_12 is true | +| 85 | 0 == y+0 when r9_3(int) = CompareNE r9_1, r9_2 is false | +| 85 | x != 0+0 when r8_13(int) = CompareEQ r8_11, r8_12 is false | +| 85 | x == 0+0 when r8_13(int) = CompareEQ r8_11, r8_12 is true | +| 85 | y != 0+0 when r9_3(int) = CompareNE r9_1, r9_2 is true | +| 85 | y == 0+0 when r9_3(int) = CompareNE r9_1, r9_2 is false | +| 94 | 0 != x+0 when r13_5(int) = CompareNE r13_3, r13_4 is true | +| 94 | 0 == x+0 when r13_5(int) = CompareNE r13_3, r13_4 is false | +| 94 | x != 0+0 when r13_5(int) = CompareNE r13_3, r13_4 is true | +| 94 | x == 0+0 when r13_5(int) = CompareNE r13_3, r13_4 is false | +| 102 | 10 < j+1 when r16_6(int) = CompareLT r16_4, r16_5 is false | +| 102 | 10 >= j+1 when r16_6(int) = CompareLT r16_4, r16_5 is true | +| 102 | j < 10+0 when r16_6(int) = CompareLT r16_4, r16_5 is true | +| 102 | j >= 10+0 when r16_6(int) = CompareLT r16_4, r16_5 is false | +| 109 | 0 != x+0 when r2_9(int) = CompareEQ r2_7, r2_8 is false | +| 109 | 0 < y+1 when r3_3(int) = CompareLT r3_1, r3_2 is false | +| 109 | 0 == x+0 when r2_9(int) = CompareEQ r2_7, r2_8 is true | +| 109 | 0 >= y+1 when r3_3(int) = CompareLT r3_1, r3_2 is true | +| 109 | x != 0+0 when r2_9(int) = CompareEQ r2_7, r2_8 is false | +| 109 | x == 0+0 when r2_9(int) = CompareEQ r2_7, r2_8 is true | +| 109 | y < 0+0 when r3_3(int) = CompareLT r3_1, r3_2 is true | +| 109 | y >= 0+0 when r3_3(int) = CompareLT r3_1, r3_2 is false | +irGuardsControl +| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | false | 11 | 11 | +| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | true | 8 | 8 | +| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | true | 17 | 17 | +| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | true | 18 | 18 | +| test.c:17:17:17:21 | r17_3(int) = CompareGT r17_1, r17_2 | true | 18 | 18 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 2 | 2 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 31 | 31 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 34 | 34 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 35 | 35 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 39 | 39 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 42 | 42 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 43 | 43 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 45 | 45 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 46 | 46 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 49 | 49 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 52 | 52 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 56 | 56 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 58 | 58 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 59 | 59 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 62 | 62 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | true | 27 | 27 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 2 | 2 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 39 | 39 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 42 | 42 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 43 | 43 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 45 | 45 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 46 | 46 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 49 | 49 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 52 | 52 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 56 | 56 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 58 | 58 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 59 | 59 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 62 | 62 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | true | 35 | 35 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 42 | 42 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 43 | 43 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 45 | 45 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 46 | 46 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 49 | 49 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 52 | 52 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | false | 52 | 52 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | true | 45 | 45 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | true | 46 | 46 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | true | 49 | 49 | +| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | false | 49 | 49 | +| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | true | 46 | 46 | +| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | false | 58 | 58 | +| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | false | 62 | 62 | +| test.c:58:19:58:23 | r11_3(int) = CompareLT r11_1, r11_2 | false | 62 | 62 | +| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | false | 79 | 79 | +| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | true | 76 | 76 | +| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | true | 85 | 85 | +| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | true | 86 | 86 | +| test.c:85:18:85:23 | r9_3(int) = CompareNE r9_1, r9_2 | true | 86 | 86 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 70 | 70 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 99 | 99 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 102 | 102 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 103 | 103 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 107 | 107 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 109 | 109 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 110 | 110 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 113 | 113 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | true | 95 | 95 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | false | 70 | 70 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | false | 107 | 107 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | false | 109 | 109 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | false | 110 | 110 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | false | 113 | 113 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | true | 103 | 103 | +| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | false | 109 | 109 | +| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | false | 113 | 113 | +| test.c:109:19:109:23 | r3_3(int) = CompareLT r3_1, r3_2 | false | 113 | 113 | +| test.c:126:7:126:7 | r0_5(int) = Constant[1] | true | 126 | 126 | +| test.c:126:7:126:7 | r0_5(int) = Constant[1] | true | 127 | 127 | +| test.c:126:12:126:26 | r1_1(int) = Call r1_0 | true | 127 | 127 | +| test.c:131:7:131:7 | r3_2(int) = Load r3_1, m3_0 | true | 132 | 132 | +| test.c:137:7:137:7 | r0_4(int) = Constant[0] | true | 138 | 138 | +| test.c:137:7:137:7 | r0_4(int) = Constant[0] | true | 139 | 139 | +| test.c:138:9:138:9 | r1_1(int) = Load r1_0, m0_3 | true | 139 | 139 | +| test.c:146:8:146:8 | r0_5(int) = Load r0_4, m0_3 | false | 147 | 147 | +| test.c:152:10:152:10 | r0_7(int) = Load r0_6, m0_3 | true | 152 | 152 | +| test.c:152:15:152:15 | r1_1(int) = Load r1_0, m0_5 | true | 152 | 152 | +| test.cpp:18:8:18:12 | r0_7(bool) = CompareNE r0_5, r0_6 | true | 0 | 0 | +| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | false | 34 | 34 | +| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | true | 30 | 30 | +| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | true | 32 | 32 | +| test.cpp:42:13:42:20 | r0_5(bool) = Call r0_4 | false | 53 | 53 | +| test.cpp:42:13:42:20 | r0_5(bool) = Call r0_4 | true | 44 | 44 | +irGuardsEnsure +| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | test.c:7:9:7:9 | r0_14(int) = Load r0_13, m0_3 | < | test.c:7:13:7:13 | r0_15(int) = Constant[0] | 1 | 11 | 11 | +| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | test.c:7:9:7:9 | r0_14(int) = Load r0_13, m0_3 | >= | test.c:7:13:7:13 | r0_15(int) = Constant[0] | 1 | 8 | 8 | +| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | test.c:7:13:7:13 | r0_15(int) = Constant[0] | < | test.c:7:9:7:9 | r0_14(int) = Load r0_13, m0_3 | 0 | 8 | 8 | +| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | test.c:7:13:7:13 | r0_15(int) = Constant[0] | >= | test.c:7:9:7:9 | r0_14(int) = Load r0_13, m0_3 | 0 | 11 | 11 | +| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | test.c:17:8:17:8 | r16_11(int) = Load r16_10, m0_3 | < | test.c:17:12:17:12 | r16_12(int) = Constant[0] | 0 | 17 | 17 | +| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | test.c:17:8:17:8 | r16_11(int) = Load r16_10, m0_3 | < | test.c:17:12:17:12 | r16_12(int) = Constant[0] | 0 | 18 | 18 | +| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | test.c:17:12:17:12 | r16_12(int) = Constant[0] | >= | test.c:17:8:17:8 | r16_11(int) = Load r16_10, m0_3 | 1 | 17 | 17 | +| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | test.c:17:12:17:12 | r16_12(int) = Constant[0] | >= | test.c:17:8:17:8 | r16_11(int) = Load r16_10, m0_3 | 1 | 18 | 18 | +| test.c:17:17:17:21 | r17_3(int) = CompareGT r17_1, r17_2 | test.c:17:17:17:17 | r17_1(long) = Load r17_0, m16_0 | >= | test.c:17:21:17:21 | r17_2(long) = Constant[1] | 1 | 18 | 18 | +| test.c:17:17:17:21 | r17_3(int) = CompareGT r17_1, r17_2 | test.c:17:21:17:21 | r17_2(long) = Constant[1] | < | test.c:17:17:17:17 | r17_1(long) = Load r17_0, m16_0 | 0 | 18 | 18 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 2 | 2 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 31 | 31 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 34 | 34 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 35 | 35 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 39 | 39 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 42 | 42 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 43 | 43 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 45 | 45 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 46 | 46 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 49 | 49 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 52 | 52 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 56 | 56 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 58 | 58 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 59 | 59 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 62 | 62 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | >= | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 27 | 27 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | < | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 27 | 27 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 2 | 2 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 31 | 31 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 34 | 34 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 35 | 35 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 39 | 39 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 42 | 42 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 43 | 43 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 45 | 45 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 46 | 46 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 49 | 49 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 52 | 52 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 56 | 56 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 58 | 58 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 59 | 59 | +| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 62 | 62 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | < | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 35 | 35 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 2 | 2 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 39 | 39 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 42 | 42 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 43 | 43 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 45 | 45 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 46 | 46 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 49 | 49 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 52 | 52 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 56 | 56 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 58 | 58 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 59 | 59 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 62 | 62 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 2 | 2 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 39 | 39 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 42 | 42 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 43 | 43 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 45 | 45 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 46 | 46 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 49 | 49 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 52 | 52 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 56 | 56 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 58 | 58 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 59 | 59 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 62 | 62 | +| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | >= | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 35 | 35 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 42 | 42 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 43 | 43 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 45 | 45 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 46 | 46 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 49 | 49 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 52 | 52 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 42 | 42 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 43 | 43 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 45 | 45 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 46 | 46 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 49 | 49 | +| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 52 | 52 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | < | test.c:44:16:44:16 | r4_5(int) = Constant[0] | 1 | 52 | 52 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | >= | test.c:44:16:44:16 | r4_5(int) = Constant[0] | 1 | 45 | 45 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | >= | test.c:44:16:44:16 | r4_5(int) = Constant[0] | 1 | 46 | 46 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | >= | test.c:44:16:44:16 | r4_5(int) = Constant[0] | 1 | 49 | 49 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:16:44:16 | r4_5(int) = Constant[0] | < | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | 0 | 45 | 45 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:16:44:16 | r4_5(int) = Constant[0] | < | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | 0 | 46 | 46 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:16:44:16 | r4_5(int) = Constant[0] | < | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | 0 | 49 | 49 | +| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:16:44:16 | r4_5(int) = Constant[0] | >= | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | 0 | 52 | 52 | +| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | test.c:45:16:45:16 | r5_1(long) = Load r5_0, m4_2 | < | test.c:45:20:45:20 | r5_2(long) = Constant[0] | 1 | 49 | 49 | +| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | test.c:45:16:45:16 | r5_1(long) = Load r5_0, m4_2 | >= | test.c:45:20:45:20 | r5_2(long) = Constant[0] | 1 | 46 | 46 | +| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | test.c:45:20:45:20 | r5_2(long) = Constant[0] | < | test.c:45:16:45:16 | r5_1(long) = Load r5_0, m4_2 | 0 | 46 | 46 | +| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | test.c:45:20:45:20 | r5_2(long) = Constant[0] | >= | test.c:45:16:45:16 | r5_1(long) = Load r5_0, m4_2 | 0 | 49 | 49 | +| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | test.c:58:9:58:9 | r10_3(int) = Load r10_2, m3_1 | != | test.c:58:14:58:14 | r10_4(int) = Constant[0] | 0 | 58 | 58 | +| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | test.c:58:9:58:9 | r10_3(int) = Load r10_2, m3_1 | != | test.c:58:14:58:14 | r10_4(int) = Constant[0] | 0 | 62 | 62 | +| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | test.c:58:14:58:14 | r10_4(int) = Constant[0] | != | test.c:58:9:58:9 | r10_3(int) = Load r10_2, m3_1 | 0 | 58 | 58 | +| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | test.c:58:14:58:14 | r10_4(int) = Constant[0] | != | test.c:58:9:58:9 | r10_3(int) = Load r10_2, m3_1 | 0 | 62 | 62 | +| test.c:58:19:58:23 | r11_3(int) = CompareLT r11_1, r11_2 | test.c:58:19:58:19 | r11_1(long) = Load r11_0, m10_0 | >= | test.c:58:23:58:23 | r11_2(long) = Constant[0] | 0 | 62 | 62 | +| test.c:58:19:58:23 | r11_3(int) = CompareLT r11_1, r11_2 | test.c:58:23:58:23 | r11_2(long) = Constant[0] | < | test.c:58:19:58:19 | r11_1(long) = Load r11_0, m10_0 | 1 | 62 | 62 | +| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | test.c:75:9:75:9 | r0_14(int) = Load r0_13, m0_3 | != | test.c:75:14:75:14 | r0_15(int) = Constant[0] | 0 | 79 | 79 | +| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | test.c:75:9:75:9 | r0_14(int) = Load r0_13, m0_3 | == | test.c:75:14:75:14 | r0_15(int) = Constant[0] | 0 | 76 | 76 | +| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | test.c:75:14:75:14 | r0_15(int) = Constant[0] | != | test.c:75:9:75:9 | r0_14(int) = Load r0_13, m0_3 | 0 | 79 | 79 | +| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | test.c:75:14:75:14 | r0_15(int) = Constant[0] | == | test.c:75:9:75:9 | r0_14(int) = Load r0_13, m0_3 | 0 | 76 | 76 | +| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | test.c:85:8:85:8 | r8_11(int) = Load r8_10, m0_3 | == | test.c:85:13:85:13 | r8_12(int) = Constant[0] | 0 | 85 | 85 | +| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | test.c:85:8:85:8 | r8_11(int) = Load r8_10, m0_3 | == | test.c:85:13:85:13 | r8_12(int) = Constant[0] | 0 | 86 | 86 | +| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | test.c:85:13:85:13 | r8_12(int) = Constant[0] | == | test.c:85:8:85:8 | r8_11(int) = Load r8_10, m0_3 | 0 | 85 | 85 | +| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | test.c:85:13:85:13 | r8_12(int) = Constant[0] | == | test.c:85:8:85:8 | r8_11(int) = Load r8_10, m0_3 | 0 | 86 | 86 | +| test.c:85:18:85:23 | r9_3(int) = CompareNE r9_1, r9_2 | test.c:85:18:85:18 | r9_1(long) = Load r9_0, m8_0 | != | test.c:85:23:85:23 | r9_2(long) = Constant[0] | 0 | 86 | 86 | +| test.c:85:18:85:23 | r9_3(int) = CompareNE r9_1, r9_2 | test.c:85:23:85:23 | r9_2(long) = Constant[0] | != | test.c:85:18:85:18 | r9_1(long) = Load r9_0, m8_0 | 0 | 86 | 86 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | != | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 95 | 95 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 70 | 70 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 99 | 99 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 102 | 102 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 103 | 103 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 107 | 107 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 109 | 109 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 110 | 110 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 113 | 113 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | != | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 95 | 95 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 70 | 70 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 99 | 99 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 102 | 102 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 103 | 103 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 107 | 107 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 109 | 109 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 110 | 110 | +| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 113 | 113 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | < | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 103 | 103 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | >= | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 70 | 70 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | >= | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 107 | 107 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | >= | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 109 | 109 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | >= | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 110 | 110 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | >= | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 113 | 113 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | < | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 70 | 70 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | < | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 107 | 107 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | < | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 109 | 109 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | < | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 110 | 110 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | < | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 113 | 113 | +| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | >= | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 103 | 103 | +| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | test.c:109:9:109:9 | r2_7(int) = Load r2_6, m13_0 | != | test.c:109:14:109:14 | r2_8(int) = Constant[0] | 0 | 109 | 109 | +| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | test.c:109:9:109:9 | r2_7(int) = Load r2_6, m13_0 | != | test.c:109:14:109:14 | r2_8(int) = Constant[0] | 0 | 113 | 113 | +| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | test.c:109:14:109:14 | r2_8(int) = Constant[0] | != | test.c:109:9:109:9 | r2_7(int) = Load r2_6, m13_0 | 0 | 109 | 109 | +| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | test.c:109:14:109:14 | r2_8(int) = Constant[0] | != | test.c:109:9:109:9 | r2_7(int) = Load r2_6, m13_0 | 0 | 113 | 113 | +| test.c:109:19:109:23 | r3_3(int) = CompareLT r3_1, r3_2 | test.c:109:19:109:19 | r3_1(long) = Load r3_0, m16_2 | >= | test.c:109:23:109:23 | r3_2(long) = Constant[0] | 0 | 113 | 113 | +| test.c:109:19:109:23 | r3_3(int) = CompareLT r3_1, r3_2 | test.c:109:23:109:23 | r3_2(long) = Constant[0] | < | test.c:109:19:109:19 | r3_1(long) = Load r3_0, m16_2 | 1 | 113 | 113 | +| test.cpp:18:8:18:12 | r0_7(bool) = CompareNE r0_5, r0_6 | test.cpp:18:8:18:10 | r0_5(X *) = Call r0_4, this:r0_3 | != | test.cpp:18:8:18:12 | r0_6(X *) = Constant[0] | 0 | 0 | 0 | +| test.cpp:18:8:18:12 | r0_7(bool) = CompareNE r0_5, r0_6 | test.cpp:18:8:18:12 | r0_6(X *) = Constant[0] | != | test.cpp:18:8:18:10 | r0_5(X *) = Call r0_4, this:r0_3 | 0 | 0 | 0 | +| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | != | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | == | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | 0 | 30 | 30 | +| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | == | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | 0 | 32 | 32 | +| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | != | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | == | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | 0 | 30 | 30 | +| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | == | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | 0 | 32 | 32 | diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/tests.ql b/cpp/ql/test/library-tests/controlflow/guards-ir/tests.ql new file mode 100644 index 000000000000..2bb8b2f9fa99 --- /dev/null +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/tests.ql @@ -0,0 +1,91 @@ +import cpp +import semmle.code.cpp.controlflow.IRGuards + +query predicate astGuards(GuardCondition guard) { + any() +} + +query predicate astGuardsCompare(int startLine, string msg) { + exists(GuardCondition guard, Expr left, Expr right, int k, string which, string op | + exists(boolean sense | + sense = true and which = "true" + or sense = false and which = "false" + | + guard.comparesLt(left, right, k, true, sense) and op = " < " + or + guard.comparesLt(left, right, k, false, sense) and op = " >= " + or + guard.comparesEq(left, right, k, true, sense) and op = " == " + or + guard.comparesEq(left, right, k, false, sense) and op = " != " + ) + and startLine = guard.getLocation().getStartLine() + and msg = left + op + right + "+" + k + " when " + guard + " is " + which + ) +} + +query predicate astGuardsControl(GuardCondition guard, boolean sense, int start, int end) { + exists(BasicBlock block | + guard.controls(block, sense) and + block.hasLocationInfo(_, start, _, end, _) + ) +} + +query predicate astGuardsEnsure(GuardCondition guard, Expr left, string op, Expr right, int k, int start, int end) +{ + exists(BasicBlock block | + guard.ensuresLt(left, right, k, block, true) and op = "<" + or + guard.ensuresLt(left, right, k, block, false) and op = ">=" + or + guard.ensuresEq(left, right, k, block, true) and op = "==" + or + guard.ensuresEq(left, right, k, block, false) and op = "!=" + | + block.hasLocationInfo(_, start, _, end, _) + ) +} + +query predicate irGuards(IRGuardCondition guard) { + any() +} + +query predicate irGuardsCompare(int startLine, string msg) { + exists(IRGuardCondition guard, Instruction left, Instruction right, int k, string which, string op | + exists(boolean sense | + sense = true and which = "true" + or sense = false and which = "false" + | + guard.comparesLt(left, right, k, true, sense) and op = " < " + or + guard.comparesLt(left, right, k, false, sense) and op = " >= " + or + guard.comparesEq(left, right, k, true, sense) and op = " == " + or + guard.comparesEq(left, right, k, false, sense) and op = " != " + ) + and startLine = guard.getLocation().getStartLine() + and msg = left.getUnconvertedResultExpression() + op + right.getUnconvertedResultExpression() + "+" + k + " when " + guard + " is " + which + ) +} +query predicate irGuardsControl(IRGuardCondition guard, boolean sense, int start, int end) { + exists(IRBlock block | + guard.controls(block, sense) and + block.getLocation().hasLocationInfo(_, start, _, end, _) + ) +} + +query predicate irGuardsEnsure(IRGuardCondition guard, Instruction left, string op, Instruction right, int k, int start, int end) +{ + exists(IRBlock block | + guard.ensuresLt(left, right, k, block, true) and op = "<" + or + guard.ensuresLt(left, right, k, block, false) and op = ">=" + or + guard.ensuresEq(left, right, k, block, true) and op = "==" + or + guard.ensuresEq(left, right, k, block, false) and op = "!=" + | + block.getLocation().hasLocationInfo(_, start, _, end, _) + ) +} From f5bd737adaff7cafe10d4dbe5f706a339ee70c5b Mon Sep 17 00:00:00 2001 From: Aditya Sharad Date: Fri, 28 Sep 2018 14:10:06 +0100 Subject: [PATCH 29/33] Version: Fix C# and JavaScript Eclipse plugins for 1.18. --- csharp/ql/src/META-INF/MANIFEST.MF | 2 +- javascript/ql/src/META-INF/MANIFEST.MF | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/csharp/ql/src/META-INF/MANIFEST.MF b/csharp/ql/src/META-INF/MANIFEST.MF index 2dff4b6013ac..9efc255e762b 100644 --- a/csharp/ql/src/META-INF/MANIFEST.MF +++ b/csharp/ql/src/META-INF/MANIFEST.MF @@ -5,4 +5,4 @@ Bundle-SymbolicName: com.semmle.plugin.semmlecode.csharp.queries;singleton:=true Bundle-Version: 1.18.0 Bundle-Vendor: Semmle Ltd. Bundle-ActivationPolicy: lazy -Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.0.qualifier, 1.18.0.qualifier]" +Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.0,1.18.0]" diff --git a/javascript/ql/src/META-INF/MANIFEST.MF b/javascript/ql/src/META-INF/MANIFEST.MF index 8dfe200b8b40..f7842e43898a 100644 --- a/javascript/ql/src/META-INF/MANIFEST.MF +++ b/javascript/ql/src/META-INF/MANIFEST.MF @@ -5,4 +5,4 @@ Bundle-SymbolicName: com.semmle.plugin.semmlecode.javascript.queries;singleton:= Bundle-Version: 1.18.0 Bundle-Vendor: Semmle Ltd. Bundle-ActivationPolicy: lazy -Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.0.qualifier, 1.18.0.qualifier]" +Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.0,1.18.0]" From 1c71a856e10a2168ba8f083b5377c43e6095a393 Mon Sep 17 00:00:00 2001 From: Aditya Sharad Date: Fri, 28 Sep 2018 16:39:44 +0100 Subject: [PATCH 30/33] Version: Bump to 1.18.1 dev. --- cpp/ql/src/META-INF/MANIFEST.MF | 4 ++-- csharp/ql/src/META-INF/MANIFEST.MF | 4 ++-- java/ql/src/META-INF/MANIFEST.MF | 4 ++-- javascript/ql/src/META-INF/MANIFEST.MF | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cpp/ql/src/META-INF/MANIFEST.MF b/cpp/ql/src/META-INF/MANIFEST.MF index 907b39deb610..f117922d2ef4 100644 --- a/cpp/ql/src/META-INF/MANIFEST.MF +++ b/cpp/ql/src/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Semmle C/C++ Default Queries Bundle-SymbolicName: com.semmle.plugin.semmlecode.cpp.queries;singleton:=true -Bundle-Version: 1.18.0 +Bundle-Version: 1.18.1.qualifier Bundle-Vendor: Semmle Ltd. Bundle-ActivationPolicy: lazy -Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.0,1.18.0]" +Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.1.qualifier,1.18.1.qualifier]" diff --git a/csharp/ql/src/META-INF/MANIFEST.MF b/csharp/ql/src/META-INF/MANIFEST.MF index 9efc255e762b..41a500e23d56 100644 --- a/csharp/ql/src/META-INF/MANIFEST.MF +++ b/csharp/ql/src/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Semmle C# Default Queries Bundle-SymbolicName: com.semmle.plugin.semmlecode.csharp.queries;singleton:=true -Bundle-Version: 1.18.0 +Bundle-Version: 1.18.1.qualifier Bundle-Vendor: Semmle Ltd. Bundle-ActivationPolicy: lazy -Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.0,1.18.0]" +Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.1.qualifier,1.18.1.qualifier]" diff --git a/java/ql/src/META-INF/MANIFEST.MF b/java/ql/src/META-INF/MANIFEST.MF index 36fcecc0b66b..17754c6ce38f 100644 --- a/java/ql/src/META-INF/MANIFEST.MF +++ b/java/ql/src/META-INF/MANIFEST.MF @@ -2,8 +2,8 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Semmle Default Java Queries Bundle-SymbolicName: com.semmle.plugin.semmlecode.queries;singleton:=true -Bundle-Version: 1.18.0 +Bundle-Version: 1.18.1.qualifier Bundle-Vendor: Semmle Ltd. Bundle-ActivationPolicy: lazy -Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.0,1.18.0]" +Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.1.qualifier,1.18.1.qualifier]" diff --git a/javascript/ql/src/META-INF/MANIFEST.MF b/javascript/ql/src/META-INF/MANIFEST.MF index f7842e43898a..9646c1b8ce45 100644 --- a/javascript/ql/src/META-INF/MANIFEST.MF +++ b/javascript/ql/src/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Semmle JavaScript Default Queries Bundle-SymbolicName: com.semmle.plugin.semmlecode.javascript.queries;singleton:=true -Bundle-Version: 1.18.0 +Bundle-Version: 1.18.1.qualifier Bundle-Vendor: Semmle Ltd. Bundle-ActivationPolicy: lazy -Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.0,1.18.0]" +Require-Bundle: com.semmle.plugin.qdt.ui;bundle-version="[1.18.1.qualifier,1.18.1.qualifier]" From eb987d5da917e244e571d41a7356043ae0272f52 Mon Sep 17 00:00:00 2001 From: Dave Bartolomeo Date: Sun, 30 Sep 2018 07:44:58 -0700 Subject: [PATCH 31/33] C++: Make `Instruction.toString()` less expensive Previously, `Instruction.toString()` returned the same string that is used in IR dumps, which requires numbering all instructions and generating a unique string for each instruction. This is too expensive on large snapshots. I've moved the original code into the new `Instruction.getDumpString()`, and made `Instruction.toString()` just return the opcode plus `getAST().toString()`. --- .../cpp/ir/implementation/aliased_ssa/Instruction.qll | 10 ++++++++++ .../code/cpp/ir/implementation/raw/Instruction.qll | 10 ++++++++++ .../ir/implementation/unaliased_ssa/Instruction.qll | 10 ++++++++++ 3 files changed, 30 insertions(+) diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll index bf1837298138..4603cf498481 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll @@ -133,6 +133,16 @@ class Instruction extends Construction::TInstruction { } final string toString() { + result = getOpcode().toString() + ": " + getAST().toString() + } + + /** + * Gets a string showing the result, opcode, and operands of the instruction, equivalent to what + * would be printed by PrintIR.ql. For example: + * + * `mu0_28(int) = Store r0_26, r0_27` + */ + final string getDumpString() { result = getResultString() + " = " + getOperationString() + " " + getOperandsString() } diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll index bf1837298138..4603cf498481 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll @@ -133,6 +133,16 @@ class Instruction extends Construction::TInstruction { } final string toString() { + result = getOpcode().toString() + ": " + getAST().toString() + } + + /** + * Gets a string showing the result, opcode, and operands of the instruction, equivalent to what + * would be printed by PrintIR.ql. For example: + * + * `mu0_28(int) = Store r0_26, r0_27` + */ + final string getDumpString() { result = getResultString() + " = " + getOperationString() + " " + getOperandsString() } diff --git a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll index bf1837298138..4603cf498481 100644 --- a/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll +++ b/cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll @@ -133,6 +133,16 @@ class Instruction extends Construction::TInstruction { } final string toString() { + result = getOpcode().toString() + ": " + getAST().toString() + } + + /** + * Gets a string showing the result, opcode, and operands of the instruction, equivalent to what + * would be printed by PrintIR.ql. For example: + * + * `mu0_28(int) = Store r0_26, r0_27` + */ + final string getDumpString() { result = getResultString() + " = " + getOperationString() + " " + getOperandsString() } From 37091953dcafb46b1af6baeedf925f3550387016 Mon Sep 17 00:00:00 2001 From: Dave Bartolomeo Date: Sun, 30 Sep 2018 08:25:42 -0700 Subject: [PATCH 32/33] C++: Fix test expectations after rebase --- .../controlflow/guards-ir/tests.expected | 680 +++++++++--------- 1 file changed, 340 insertions(+), 340 deletions(-) diff --git a/cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected b/cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected index 07661aaf3206..ef9603d1f0c0 100644 --- a/cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected +++ b/cpp/ql/test/library-tests/controlflow/guards-ir/tests.expected @@ -385,346 +385,346 @@ astGuardsEnsure | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 30 | 30 | | test.cpp:31:7:31:13 | ... == ... | test.cpp:31:12:31:13 | - ... | == | test.cpp:31:7:31:7 | x | 0 | 31 | 32 | irGuards -| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | -| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | -| test.c:17:17:17:21 | r17_3(int) = CompareGT r17_1, r17_2 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | -| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | -| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | -| test.c:58:19:58:23 | r11_3(int) = CompareLT r11_1, r11_2 | -| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | -| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | -| test.c:85:18:85:23 | r9_3(int) = CompareNE r9_1, r9_2 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | -| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | -| test.c:109:19:109:23 | r3_3(int) = CompareLT r3_1, r3_2 | -| test.c:126:7:126:7 | r0_5(int) = Constant[1] | -| test.c:126:12:126:26 | r1_1(int) = Call r1_0 | -| test.c:131:7:131:7 | r3_2(int) = Load r3_1, m3_0 | -| test.c:137:7:137:7 | r0_4(int) = Constant[0] | -| test.c:138:9:138:9 | r1_1(int) = Load r1_0, m0_3 | -| test.c:146:8:146:8 | r0_5(int) = Load r0_4, m0_3 | -| test.c:152:10:152:10 | r0_7(int) = Load r0_6, m0_3 | -| test.c:152:15:152:15 | r1_1(int) = Load r1_0, m0_5 | -| test.cpp:18:8:18:12 | r0_7(bool) = CompareNE r0_5, r0_6 | -| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | -| test.cpp:42:13:42:20 | r0_5(bool) = Call r0_4 | +| test.c:7:9:7:13 | CompareGT: ... > ... | +| test.c:17:8:17:12 | CompareLT: ... < ... | +| test.c:17:17:17:21 | CompareGT: ... > ... | +| test.c:26:11:26:15 | CompareGT: ... > ... | +| test.c:34:16:34:21 | CompareLT: ... < ... | +| test.c:42:16:42:21 | CompareLT: ... < ... | +| test.c:44:12:44:16 | CompareGT: ... > ... | +| test.c:45:16:45:20 | CompareGT: ... > ... | +| test.c:58:9:58:14 | CompareEQ: ... == ... | +| test.c:58:19:58:23 | CompareLT: ... < ... | +| test.c:75:9:75:14 | CompareEQ: ... == ... | +| test.c:85:8:85:13 | CompareEQ: ... == ... | +| test.c:85:18:85:23 | CompareNE: ... != ... | +| test.c:94:11:94:16 | CompareNE: ... != ... | +| test.c:102:16:102:21 | CompareLT: ... < ... | +| test.c:109:9:109:14 | CompareEQ: ... == ... | +| test.c:109:19:109:23 | CompareLT: ... < ... | +| test.c:126:7:126:7 | Constant: 1 | +| test.c:126:12:126:26 | Call: call to test3_condition | +| test.c:131:7:131:7 | Load: b | +| test.c:137:7:137:7 | Constant: 0 | +| test.c:138:9:138:9 | Load: i | +| test.c:146:8:146:8 | Load: x | +| test.c:152:10:152:10 | Load: x | +| test.c:152:15:152:15 | Load: y | +| test.cpp:18:8:18:12 | CompareNE: (bool)... | +| test.cpp:31:7:31:13 | CompareEQ: ... == ... | +| test.cpp:42:13:42:20 | Call: call to getABool | irGuardsCompare -| 7 | 0 < x+0 when r0_16(int) = CompareGT r0_14, r0_15 is true | -| 7 | 0 >= x+0 when r0_16(int) = CompareGT r0_14, r0_15 is false | -| 7 | x < 0+1 when r0_16(int) = CompareGT r0_14, r0_15 is false | -| 7 | x >= 0+1 when r0_16(int) = CompareGT r0_14, r0_15 is true | -| 17 | 0 < x+1 when r16_13(int) = CompareLT r16_11, r16_12 is false | -| 17 | 0 >= x+1 when r16_13(int) = CompareLT r16_11, r16_12 is true | -| 17 | 1 < y+0 when r17_3(int) = CompareGT r17_1, r17_2 is true | -| 17 | 1 >= y+0 when r17_3(int) = CompareGT r17_1, r17_2 is false | -| 17 | x < 0+0 when r16_13(int) = CompareLT r16_11, r16_12 is true | -| 17 | x >= 0+0 when r16_13(int) = CompareLT r16_11, r16_12 is false | -| 17 | y < 1+1 when r17_3(int) = CompareGT r17_1, r17_2 is false | -| 17 | y >= 1+1 when r17_3(int) = CompareGT r17_1, r17_2 is true | -| 26 | 0 < x+0 when r21_5(int) = CompareGT r21_3, r21_4 is true | -| 26 | 0 >= x+0 when r21_5(int) = CompareGT r21_3, r21_4 is false | -| 26 | x < 0+1 when r21_5(int) = CompareGT r21_3, r21_4 is false | -| 26 | x >= 0+1 when r21_5(int) = CompareGT r21_3, r21_4 is true | -| 31 | - ... != x+0 when r0_7(bool) = CompareEQ r0_5, r0_6 is false | -| 31 | - ... == x+0 when r0_7(bool) = CompareEQ r0_5, r0_6 is true | -| 31 | x != - ...+0 when r0_7(bool) = CompareEQ r0_5, r0_6 is false | -| 31 | x == - ...+0 when r0_7(bool) = CompareEQ r0_5, r0_6 is true | -| 34 | 10 < j+1 when r24_6(int) = CompareLT r24_4, r24_5 is false | -| 34 | 10 >= j+1 when r24_6(int) = CompareLT r24_4, r24_5 is true | -| 34 | j < 10+0 when r24_6(int) = CompareLT r24_4, r24_5 is true | -| 34 | j >= 10+0 when r24_6(int) = CompareLT r24_4, r24_5 is false | -| 42 | 10 < j+1 when r3_6(int) = CompareLT r3_4, r3_5 is false | -| 42 | 10 >= j+1 when r3_6(int) = CompareLT r3_4, r3_5 is true | -| 42 | j < 10+0 when r3_6(int) = CompareLT r3_4, r3_5 is true | -| 42 | j >= 10+0 when r3_6(int) = CompareLT r3_4, r3_5 is false | -| 44 | 0 < z+0 when r4_6(int) = CompareGT r4_4, r4_5 is true | -| 44 | 0 >= z+0 when r4_6(int) = CompareGT r4_4, r4_5 is false | -| 44 | z < 0+1 when r4_6(int) = CompareGT r4_4, r4_5 is false | -| 44 | z >= 0+1 when r4_6(int) = CompareGT r4_4, r4_5 is true | -| 45 | 0 < y+0 when r5_3(int) = CompareGT r5_1, r5_2 is true | -| 45 | 0 >= y+0 when r5_3(int) = CompareGT r5_1, r5_2 is false | -| 45 | y < 0+1 when r5_3(int) = CompareGT r5_1, r5_2 is false | -| 45 | y >= 0+1 when r5_3(int) = CompareGT r5_1, r5_2 is true | -| 58 | 0 != x+0 when r10_5(int) = CompareEQ r10_3, r10_4 is false | -| 58 | 0 < y+1 when r11_3(int) = CompareLT r11_1, r11_2 is false | -| 58 | 0 == x+0 when r10_5(int) = CompareEQ r10_3, r10_4 is true | -| 58 | 0 >= y+1 when r11_3(int) = CompareLT r11_1, r11_2 is true | -| 58 | x != 0+0 when r10_5(int) = CompareEQ r10_3, r10_4 is false | -| 58 | x == 0+0 when r10_5(int) = CompareEQ r10_3, r10_4 is true | -| 58 | y < 0+0 when r11_3(int) = CompareLT r11_1, r11_2 is true | -| 58 | y >= 0+0 when r11_3(int) = CompareLT r11_1, r11_2 is false | -| 75 | 0 != x+0 when r0_16(int) = CompareEQ r0_14, r0_15 is false | -| 75 | 0 == x+0 when r0_16(int) = CompareEQ r0_14, r0_15 is true | -| 75 | x != 0+0 when r0_16(int) = CompareEQ r0_14, r0_15 is false | -| 75 | x == 0+0 when r0_16(int) = CompareEQ r0_14, r0_15 is true | -| 85 | 0 != x+0 when r8_13(int) = CompareEQ r8_11, r8_12 is false | -| 85 | 0 != y+0 when r9_3(int) = CompareNE r9_1, r9_2 is true | -| 85 | 0 == x+0 when r8_13(int) = CompareEQ r8_11, r8_12 is true | -| 85 | 0 == y+0 when r9_3(int) = CompareNE r9_1, r9_2 is false | -| 85 | x != 0+0 when r8_13(int) = CompareEQ r8_11, r8_12 is false | -| 85 | x == 0+0 when r8_13(int) = CompareEQ r8_11, r8_12 is true | -| 85 | y != 0+0 when r9_3(int) = CompareNE r9_1, r9_2 is true | -| 85 | y == 0+0 when r9_3(int) = CompareNE r9_1, r9_2 is false | -| 94 | 0 != x+0 when r13_5(int) = CompareNE r13_3, r13_4 is true | -| 94 | 0 == x+0 when r13_5(int) = CompareNE r13_3, r13_4 is false | -| 94 | x != 0+0 when r13_5(int) = CompareNE r13_3, r13_4 is true | -| 94 | x == 0+0 when r13_5(int) = CompareNE r13_3, r13_4 is false | -| 102 | 10 < j+1 when r16_6(int) = CompareLT r16_4, r16_5 is false | -| 102 | 10 >= j+1 when r16_6(int) = CompareLT r16_4, r16_5 is true | -| 102 | j < 10+0 when r16_6(int) = CompareLT r16_4, r16_5 is true | -| 102 | j >= 10+0 when r16_6(int) = CompareLT r16_4, r16_5 is false | -| 109 | 0 != x+0 when r2_9(int) = CompareEQ r2_7, r2_8 is false | -| 109 | 0 < y+1 when r3_3(int) = CompareLT r3_1, r3_2 is false | -| 109 | 0 == x+0 when r2_9(int) = CompareEQ r2_7, r2_8 is true | -| 109 | 0 >= y+1 when r3_3(int) = CompareLT r3_1, r3_2 is true | -| 109 | x != 0+0 when r2_9(int) = CompareEQ r2_7, r2_8 is false | -| 109 | x == 0+0 when r2_9(int) = CompareEQ r2_7, r2_8 is true | -| 109 | y < 0+0 when r3_3(int) = CompareLT r3_1, r3_2 is true | -| 109 | y >= 0+0 when r3_3(int) = CompareLT r3_1, r3_2 is false | +| 7 | 0 < x+0 when CompareGT: ... > ... is true | +| 7 | 0 >= x+0 when CompareGT: ... > ... is false | +| 7 | x < 0+1 when CompareGT: ... > ... is false | +| 7 | x >= 0+1 when CompareGT: ... > ... is true | +| 17 | 0 < x+1 when CompareLT: ... < ... is false | +| 17 | 0 >= x+1 when CompareLT: ... < ... is true | +| 17 | 1 < y+0 when CompareGT: ... > ... is true | +| 17 | 1 >= y+0 when CompareGT: ... > ... is false | +| 17 | x < 0+0 when CompareLT: ... < ... is true | +| 17 | x >= 0+0 when CompareLT: ... < ... is false | +| 17 | y < 1+1 when CompareGT: ... > ... is false | +| 17 | y >= 1+1 when CompareGT: ... > ... is true | +| 26 | 0 < x+0 when CompareGT: ... > ... is true | +| 26 | 0 >= x+0 when CompareGT: ... > ... is false | +| 26 | x < 0+1 when CompareGT: ... > ... is false | +| 26 | x >= 0+1 when CompareGT: ... > ... is true | +| 31 | - ... != x+0 when CompareEQ: ... == ... is false | +| 31 | - ... == x+0 when CompareEQ: ... == ... is true | +| 31 | x != - ...+0 when CompareEQ: ... == ... is false | +| 31 | x == - ...+0 when CompareEQ: ... == ... is true | +| 34 | 10 < j+1 when CompareLT: ... < ... is false | +| 34 | 10 >= j+1 when CompareLT: ... < ... is true | +| 34 | j < 10+0 when CompareLT: ... < ... is true | +| 34 | j >= 10+0 when CompareLT: ... < ... is false | +| 42 | 10 < j+1 when CompareLT: ... < ... is false | +| 42 | 10 >= j+1 when CompareLT: ... < ... is true | +| 42 | j < 10+0 when CompareLT: ... < ... is true | +| 42 | j >= 10+0 when CompareLT: ... < ... is false | +| 44 | 0 < z+0 when CompareGT: ... > ... is true | +| 44 | 0 >= z+0 when CompareGT: ... > ... is false | +| 44 | z < 0+1 when CompareGT: ... > ... is false | +| 44 | z >= 0+1 when CompareGT: ... > ... is true | +| 45 | 0 < y+0 when CompareGT: ... > ... is true | +| 45 | 0 >= y+0 when CompareGT: ... > ... is false | +| 45 | y < 0+1 when CompareGT: ... > ... is false | +| 45 | y >= 0+1 when CompareGT: ... > ... is true | +| 58 | 0 != x+0 when CompareEQ: ... == ... is false | +| 58 | 0 < y+1 when CompareLT: ... < ... is false | +| 58 | 0 == x+0 when CompareEQ: ... == ... is true | +| 58 | 0 >= y+1 when CompareLT: ... < ... is true | +| 58 | x != 0+0 when CompareEQ: ... == ... is false | +| 58 | x == 0+0 when CompareEQ: ... == ... is true | +| 58 | y < 0+0 when CompareLT: ... < ... is true | +| 58 | y >= 0+0 when CompareLT: ... < ... is false | +| 75 | 0 != x+0 when CompareEQ: ... == ... is false | +| 75 | 0 == x+0 when CompareEQ: ... == ... is true | +| 75 | x != 0+0 when CompareEQ: ... == ... is false | +| 75 | x == 0+0 when CompareEQ: ... == ... is true | +| 85 | 0 != x+0 when CompareEQ: ... == ... is false | +| 85 | 0 != y+0 when CompareNE: ... != ... is true | +| 85 | 0 == x+0 when CompareEQ: ... == ... is true | +| 85 | 0 == y+0 when CompareNE: ... != ... is false | +| 85 | x != 0+0 when CompareEQ: ... == ... is false | +| 85 | x == 0+0 when CompareEQ: ... == ... is true | +| 85 | y != 0+0 when CompareNE: ... != ... is true | +| 85 | y == 0+0 when CompareNE: ... != ... is false | +| 94 | 0 != x+0 when CompareNE: ... != ... is true | +| 94 | 0 == x+0 when CompareNE: ... != ... is false | +| 94 | x != 0+0 when CompareNE: ... != ... is true | +| 94 | x == 0+0 when CompareNE: ... != ... is false | +| 102 | 10 < j+1 when CompareLT: ... < ... is false | +| 102 | 10 >= j+1 when CompareLT: ... < ... is true | +| 102 | j < 10+0 when CompareLT: ... < ... is true | +| 102 | j >= 10+0 when CompareLT: ... < ... is false | +| 109 | 0 != x+0 when CompareEQ: ... == ... is false | +| 109 | 0 < y+1 when CompareLT: ... < ... is false | +| 109 | 0 == x+0 when CompareEQ: ... == ... is true | +| 109 | 0 >= y+1 when CompareLT: ... < ... is true | +| 109 | x != 0+0 when CompareEQ: ... == ... is false | +| 109 | x == 0+0 when CompareEQ: ... == ... is true | +| 109 | y < 0+0 when CompareLT: ... < ... is true | +| 109 | y >= 0+0 when CompareLT: ... < ... is false | irGuardsControl -| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | false | 11 | 11 | -| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | true | 8 | 8 | -| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | true | 17 | 17 | -| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | true | 18 | 18 | -| test.c:17:17:17:21 | r17_3(int) = CompareGT r17_1, r17_2 | true | 18 | 18 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 2 | 2 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 31 | 31 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 34 | 34 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 35 | 35 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 39 | 39 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 42 | 42 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 43 | 43 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 45 | 45 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 46 | 46 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 49 | 49 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 52 | 52 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 56 | 56 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 58 | 58 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 59 | 59 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | false | 62 | 62 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | true | 27 | 27 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 2 | 2 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 39 | 39 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 42 | 42 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 43 | 43 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 45 | 45 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 46 | 46 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 49 | 49 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 52 | 52 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 56 | 56 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 58 | 58 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 59 | 59 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | false | 62 | 62 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | true | 35 | 35 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 42 | 42 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 43 | 43 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 45 | 45 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 46 | 46 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 49 | 49 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | true | 52 | 52 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | false | 52 | 52 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | true | 45 | 45 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | true | 46 | 46 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | true | 49 | 49 | -| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | false | 49 | 49 | -| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | true | 46 | 46 | -| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | false | 58 | 58 | -| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | false | 62 | 62 | -| test.c:58:19:58:23 | r11_3(int) = CompareLT r11_1, r11_2 | false | 62 | 62 | -| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | false | 79 | 79 | -| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | true | 76 | 76 | -| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | true | 85 | 85 | -| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | true | 86 | 86 | -| test.c:85:18:85:23 | r9_3(int) = CompareNE r9_1, r9_2 | true | 86 | 86 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 70 | 70 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 99 | 99 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 102 | 102 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 103 | 103 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 107 | 107 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 109 | 109 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 110 | 110 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | false | 113 | 113 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | true | 95 | 95 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | false | 70 | 70 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | false | 107 | 107 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | false | 109 | 109 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | false | 110 | 110 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | false | 113 | 113 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | true | 103 | 103 | -| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | false | 109 | 109 | -| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | false | 113 | 113 | -| test.c:109:19:109:23 | r3_3(int) = CompareLT r3_1, r3_2 | false | 113 | 113 | -| test.c:126:7:126:7 | r0_5(int) = Constant[1] | true | 126 | 126 | -| test.c:126:7:126:7 | r0_5(int) = Constant[1] | true | 127 | 127 | -| test.c:126:12:126:26 | r1_1(int) = Call r1_0 | true | 127 | 127 | -| test.c:131:7:131:7 | r3_2(int) = Load r3_1, m3_0 | true | 132 | 132 | -| test.c:137:7:137:7 | r0_4(int) = Constant[0] | true | 138 | 138 | -| test.c:137:7:137:7 | r0_4(int) = Constant[0] | true | 139 | 139 | -| test.c:138:9:138:9 | r1_1(int) = Load r1_0, m0_3 | true | 139 | 139 | -| test.c:146:8:146:8 | r0_5(int) = Load r0_4, m0_3 | false | 147 | 147 | -| test.c:152:10:152:10 | r0_7(int) = Load r0_6, m0_3 | true | 152 | 152 | -| test.c:152:15:152:15 | r1_1(int) = Load r1_0, m0_5 | true | 152 | 152 | -| test.cpp:18:8:18:12 | r0_7(bool) = CompareNE r0_5, r0_6 | true | 0 | 0 | -| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | false | 34 | 34 | -| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | true | 30 | 30 | -| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | true | 32 | 32 | -| test.cpp:42:13:42:20 | r0_5(bool) = Call r0_4 | false | 53 | 53 | -| test.cpp:42:13:42:20 | r0_5(bool) = Call r0_4 | true | 44 | 44 | +| test.c:7:9:7:13 | CompareGT: ... > ... | false | 11 | 11 | +| test.c:7:9:7:13 | CompareGT: ... > ... | true | 8 | 8 | +| test.c:17:8:17:12 | CompareLT: ... < ... | true | 17 | 17 | +| test.c:17:8:17:12 | CompareLT: ... < ... | true | 18 | 18 | +| test.c:17:17:17:21 | CompareGT: ... > ... | true | 18 | 18 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 2 | 2 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 31 | 31 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 34 | 34 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 35 | 35 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 39 | 39 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 42 | 42 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 43 | 43 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 45 | 45 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 46 | 46 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 49 | 49 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 52 | 52 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 56 | 56 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 58 | 58 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 59 | 59 | +| test.c:26:11:26:15 | CompareGT: ... > ... | false | 62 | 62 | +| test.c:26:11:26:15 | CompareGT: ... > ... | true | 27 | 27 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 2 | 2 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 39 | 39 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 42 | 42 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 43 | 43 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 45 | 45 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 46 | 46 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 49 | 49 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 52 | 52 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 56 | 56 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 58 | 58 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 59 | 59 | +| test.c:34:16:34:21 | CompareLT: ... < ... | false | 62 | 62 | +| test.c:34:16:34:21 | CompareLT: ... < ... | true | 35 | 35 | +| test.c:42:16:42:21 | CompareLT: ... < ... | true | 42 | 42 | +| test.c:42:16:42:21 | CompareLT: ... < ... | true | 43 | 43 | +| test.c:42:16:42:21 | CompareLT: ... < ... | true | 45 | 45 | +| test.c:42:16:42:21 | CompareLT: ... < ... | true | 46 | 46 | +| test.c:42:16:42:21 | CompareLT: ... < ... | true | 49 | 49 | +| test.c:42:16:42:21 | CompareLT: ... < ... | true | 52 | 52 | +| test.c:44:12:44:16 | CompareGT: ... > ... | false | 52 | 52 | +| test.c:44:12:44:16 | CompareGT: ... > ... | true | 45 | 45 | +| test.c:44:12:44:16 | CompareGT: ... > ... | true | 46 | 46 | +| test.c:44:12:44:16 | CompareGT: ... > ... | true | 49 | 49 | +| test.c:45:16:45:20 | CompareGT: ... > ... | false | 49 | 49 | +| test.c:45:16:45:20 | CompareGT: ... > ... | true | 46 | 46 | +| test.c:58:9:58:14 | CompareEQ: ... == ... | false | 58 | 58 | +| test.c:58:9:58:14 | CompareEQ: ... == ... | false | 62 | 62 | +| test.c:58:19:58:23 | CompareLT: ... < ... | false | 62 | 62 | +| test.c:75:9:75:14 | CompareEQ: ... == ... | false | 79 | 79 | +| test.c:75:9:75:14 | CompareEQ: ... == ... | true | 76 | 76 | +| test.c:85:8:85:13 | CompareEQ: ... == ... | true | 85 | 85 | +| test.c:85:8:85:13 | CompareEQ: ... == ... | true | 86 | 86 | +| test.c:85:18:85:23 | CompareNE: ... != ... | true | 86 | 86 | +| test.c:94:11:94:16 | CompareNE: ... != ... | false | 70 | 70 | +| test.c:94:11:94:16 | CompareNE: ... != ... | false | 99 | 99 | +| test.c:94:11:94:16 | CompareNE: ... != ... | false | 102 | 102 | +| test.c:94:11:94:16 | CompareNE: ... != ... | false | 103 | 103 | +| test.c:94:11:94:16 | CompareNE: ... != ... | false | 107 | 107 | +| test.c:94:11:94:16 | CompareNE: ... != ... | false | 109 | 109 | +| test.c:94:11:94:16 | CompareNE: ... != ... | false | 110 | 110 | +| test.c:94:11:94:16 | CompareNE: ... != ... | false | 113 | 113 | +| test.c:94:11:94:16 | CompareNE: ... != ... | true | 95 | 95 | +| test.c:102:16:102:21 | CompareLT: ... < ... | false | 70 | 70 | +| test.c:102:16:102:21 | CompareLT: ... < ... | false | 107 | 107 | +| test.c:102:16:102:21 | CompareLT: ... < ... | false | 109 | 109 | +| test.c:102:16:102:21 | CompareLT: ... < ... | false | 110 | 110 | +| test.c:102:16:102:21 | CompareLT: ... < ... | false | 113 | 113 | +| test.c:102:16:102:21 | CompareLT: ... < ... | true | 103 | 103 | +| test.c:109:9:109:14 | CompareEQ: ... == ... | false | 109 | 109 | +| test.c:109:9:109:14 | CompareEQ: ... == ... | false | 113 | 113 | +| test.c:109:19:109:23 | CompareLT: ... < ... | false | 113 | 113 | +| test.c:126:7:126:7 | Constant: 1 | true | 126 | 126 | +| test.c:126:7:126:7 | Constant: 1 | true | 127 | 127 | +| test.c:126:12:126:26 | Call: call to test3_condition | true | 127 | 127 | +| test.c:131:7:131:7 | Load: b | true | 132 | 132 | +| test.c:137:7:137:7 | Constant: 0 | true | 138 | 138 | +| test.c:137:7:137:7 | Constant: 0 | true | 139 | 139 | +| test.c:138:9:138:9 | Load: i | true | 139 | 139 | +| test.c:146:8:146:8 | Load: x | false | 147 | 147 | +| test.c:152:10:152:10 | Load: x | true | 152 | 152 | +| test.c:152:15:152:15 | Load: y | true | 152 | 152 | +| test.cpp:18:8:18:12 | CompareNE: (bool)... | true | 0 | 0 | +| test.cpp:31:7:31:13 | CompareEQ: ... == ... | false | 34 | 34 | +| test.cpp:31:7:31:13 | CompareEQ: ... == ... | true | 30 | 30 | +| test.cpp:31:7:31:13 | CompareEQ: ... == ... | true | 32 | 32 | +| test.cpp:42:13:42:20 | Call: call to getABool | false | 53 | 53 | +| test.cpp:42:13:42:20 | Call: call to getABool | true | 44 | 44 | irGuardsEnsure -| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | test.c:7:9:7:9 | r0_14(int) = Load r0_13, m0_3 | < | test.c:7:13:7:13 | r0_15(int) = Constant[0] | 1 | 11 | 11 | -| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | test.c:7:9:7:9 | r0_14(int) = Load r0_13, m0_3 | >= | test.c:7:13:7:13 | r0_15(int) = Constant[0] | 1 | 8 | 8 | -| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | test.c:7:13:7:13 | r0_15(int) = Constant[0] | < | test.c:7:9:7:9 | r0_14(int) = Load r0_13, m0_3 | 0 | 8 | 8 | -| test.c:7:9:7:13 | r0_16(int) = CompareGT r0_14, r0_15 | test.c:7:13:7:13 | r0_15(int) = Constant[0] | >= | test.c:7:9:7:9 | r0_14(int) = Load r0_13, m0_3 | 0 | 11 | 11 | -| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | test.c:17:8:17:8 | r16_11(int) = Load r16_10, m0_3 | < | test.c:17:12:17:12 | r16_12(int) = Constant[0] | 0 | 17 | 17 | -| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | test.c:17:8:17:8 | r16_11(int) = Load r16_10, m0_3 | < | test.c:17:12:17:12 | r16_12(int) = Constant[0] | 0 | 18 | 18 | -| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | test.c:17:12:17:12 | r16_12(int) = Constant[0] | >= | test.c:17:8:17:8 | r16_11(int) = Load r16_10, m0_3 | 1 | 17 | 17 | -| test.c:17:8:17:12 | r16_13(int) = CompareLT r16_11, r16_12 | test.c:17:12:17:12 | r16_12(int) = Constant[0] | >= | test.c:17:8:17:8 | r16_11(int) = Load r16_10, m0_3 | 1 | 18 | 18 | -| test.c:17:17:17:21 | r17_3(int) = CompareGT r17_1, r17_2 | test.c:17:17:17:17 | r17_1(long) = Load r17_0, m16_0 | >= | test.c:17:21:17:21 | r17_2(long) = Constant[1] | 1 | 18 | 18 | -| test.c:17:17:17:21 | r17_3(int) = CompareGT r17_1, r17_2 | test.c:17:21:17:21 | r17_2(long) = Constant[1] | < | test.c:17:17:17:17 | r17_1(long) = Load r17_0, m16_0 | 0 | 18 | 18 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 2 | 2 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 31 | 31 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 34 | 34 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 35 | 35 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 39 | 39 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 42 | 42 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 43 | 43 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 45 | 45 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 46 | 46 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 49 | 49 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 52 | 52 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 56 | 56 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 58 | 58 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 59 | 59 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | < | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 62 | 62 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | >= | test.c:26:15:26:15 | r21_4(int) = Constant[0] | 1 | 27 | 27 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | < | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 27 | 27 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 2 | 2 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 31 | 31 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 34 | 34 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 35 | 35 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 39 | 39 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 42 | 42 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 43 | 43 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 45 | 45 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 46 | 46 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 49 | 49 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 52 | 52 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 56 | 56 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 58 | 58 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 59 | 59 | -| test.c:26:11:26:15 | r21_5(int) = CompareGT r21_3, r21_4 | test.c:26:15:26:15 | r21_4(int) = Constant[0] | >= | test.c:26:11:26:11 | r21_3(int) = Load r21_2, m21_0 | 0 | 62 | 62 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | < | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 35 | 35 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 2 | 2 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 39 | 39 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 42 | 42 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 43 | 43 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 45 | 45 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 46 | 46 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 49 | 49 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 52 | 52 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 56 | 56 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 58 | 58 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 59 | 59 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | >= | test.c:34:20:34:21 | r24_5(int) = Constant[10] | 0 | 62 | 62 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 2 | 2 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 39 | 39 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 42 | 42 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 43 | 43 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 45 | 45 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 46 | 46 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 49 | 49 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 52 | 52 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 56 | 56 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 58 | 58 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 59 | 59 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | < | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 62 | 62 | -| test.c:34:16:34:21 | r24_6(int) = CompareLT r24_4, r24_5 | test.c:34:20:34:21 | r24_5(int) = Constant[10] | >= | test.c:34:16:34:16 | r24_4(int) = Load r24_3, m24_0 | 1 | 35 | 35 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 42 | 42 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 43 | 43 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 45 | 45 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 46 | 46 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 49 | 49 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | < | test.c:42:20:42:21 | r3_5(int) = Constant[10] | 0 | 52 | 52 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 42 | 42 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 43 | 43 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 45 | 45 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 46 | 46 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 49 | 49 | -| test.c:42:16:42:21 | r3_6(int) = CompareLT r3_4, r3_5 | test.c:42:20:42:21 | r3_5(int) = Constant[10] | >= | test.c:42:16:42:16 | r3_4(int) = Load r3_3, m3_0 | 1 | 52 | 52 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | < | test.c:44:16:44:16 | r4_5(int) = Constant[0] | 1 | 52 | 52 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | >= | test.c:44:16:44:16 | r4_5(int) = Constant[0] | 1 | 45 | 45 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | >= | test.c:44:16:44:16 | r4_5(int) = Constant[0] | 1 | 46 | 46 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | >= | test.c:44:16:44:16 | r4_5(int) = Constant[0] | 1 | 49 | 49 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:16:44:16 | r4_5(int) = Constant[0] | < | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | 0 | 45 | 45 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:16:44:16 | r4_5(int) = Constant[0] | < | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | 0 | 46 | 46 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:16:44:16 | r4_5(int) = Constant[0] | < | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | 0 | 49 | 49 | -| test.c:44:12:44:16 | r4_6(int) = CompareGT r4_4, r4_5 | test.c:44:16:44:16 | r4_5(int) = Constant[0] | >= | test.c:44:12:44:12 | r4_4(int) = Load r4_3, m2_5 | 0 | 52 | 52 | -| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | test.c:45:16:45:16 | r5_1(long) = Load r5_0, m4_2 | < | test.c:45:20:45:20 | r5_2(long) = Constant[0] | 1 | 49 | 49 | -| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | test.c:45:16:45:16 | r5_1(long) = Load r5_0, m4_2 | >= | test.c:45:20:45:20 | r5_2(long) = Constant[0] | 1 | 46 | 46 | -| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | test.c:45:20:45:20 | r5_2(long) = Constant[0] | < | test.c:45:16:45:16 | r5_1(long) = Load r5_0, m4_2 | 0 | 46 | 46 | -| test.c:45:16:45:20 | r5_3(int) = CompareGT r5_1, r5_2 | test.c:45:20:45:20 | r5_2(long) = Constant[0] | >= | test.c:45:16:45:16 | r5_1(long) = Load r5_0, m4_2 | 0 | 49 | 49 | -| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | test.c:58:9:58:9 | r10_3(int) = Load r10_2, m3_1 | != | test.c:58:14:58:14 | r10_4(int) = Constant[0] | 0 | 58 | 58 | -| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | test.c:58:9:58:9 | r10_3(int) = Load r10_2, m3_1 | != | test.c:58:14:58:14 | r10_4(int) = Constant[0] | 0 | 62 | 62 | -| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | test.c:58:14:58:14 | r10_4(int) = Constant[0] | != | test.c:58:9:58:9 | r10_3(int) = Load r10_2, m3_1 | 0 | 58 | 58 | -| test.c:58:9:58:14 | r10_5(int) = CompareEQ r10_3, r10_4 | test.c:58:14:58:14 | r10_4(int) = Constant[0] | != | test.c:58:9:58:9 | r10_3(int) = Load r10_2, m3_1 | 0 | 62 | 62 | -| test.c:58:19:58:23 | r11_3(int) = CompareLT r11_1, r11_2 | test.c:58:19:58:19 | r11_1(long) = Load r11_0, m10_0 | >= | test.c:58:23:58:23 | r11_2(long) = Constant[0] | 0 | 62 | 62 | -| test.c:58:19:58:23 | r11_3(int) = CompareLT r11_1, r11_2 | test.c:58:23:58:23 | r11_2(long) = Constant[0] | < | test.c:58:19:58:19 | r11_1(long) = Load r11_0, m10_0 | 1 | 62 | 62 | -| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | test.c:75:9:75:9 | r0_14(int) = Load r0_13, m0_3 | != | test.c:75:14:75:14 | r0_15(int) = Constant[0] | 0 | 79 | 79 | -| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | test.c:75:9:75:9 | r0_14(int) = Load r0_13, m0_3 | == | test.c:75:14:75:14 | r0_15(int) = Constant[0] | 0 | 76 | 76 | -| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | test.c:75:14:75:14 | r0_15(int) = Constant[0] | != | test.c:75:9:75:9 | r0_14(int) = Load r0_13, m0_3 | 0 | 79 | 79 | -| test.c:75:9:75:14 | r0_16(int) = CompareEQ r0_14, r0_15 | test.c:75:14:75:14 | r0_15(int) = Constant[0] | == | test.c:75:9:75:9 | r0_14(int) = Load r0_13, m0_3 | 0 | 76 | 76 | -| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | test.c:85:8:85:8 | r8_11(int) = Load r8_10, m0_3 | == | test.c:85:13:85:13 | r8_12(int) = Constant[0] | 0 | 85 | 85 | -| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | test.c:85:8:85:8 | r8_11(int) = Load r8_10, m0_3 | == | test.c:85:13:85:13 | r8_12(int) = Constant[0] | 0 | 86 | 86 | -| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | test.c:85:13:85:13 | r8_12(int) = Constant[0] | == | test.c:85:8:85:8 | r8_11(int) = Load r8_10, m0_3 | 0 | 85 | 85 | -| test.c:85:8:85:13 | r8_13(int) = CompareEQ r8_11, r8_12 | test.c:85:13:85:13 | r8_12(int) = Constant[0] | == | test.c:85:8:85:8 | r8_11(int) = Load r8_10, m0_3 | 0 | 86 | 86 | -| test.c:85:18:85:23 | r9_3(int) = CompareNE r9_1, r9_2 | test.c:85:18:85:18 | r9_1(long) = Load r9_0, m8_0 | != | test.c:85:23:85:23 | r9_2(long) = Constant[0] | 0 | 86 | 86 | -| test.c:85:18:85:23 | r9_3(int) = CompareNE r9_1, r9_2 | test.c:85:23:85:23 | r9_2(long) = Constant[0] | != | test.c:85:18:85:18 | r9_1(long) = Load r9_0, m8_0 | 0 | 86 | 86 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | != | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 95 | 95 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 70 | 70 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 99 | 99 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 102 | 102 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 103 | 103 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 107 | 107 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 109 | 109 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 110 | 110 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | == | test.c:94:16:94:16 | r13_4(int) = Constant[0] | 0 | 113 | 113 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | != | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 95 | 95 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 70 | 70 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 99 | 99 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 102 | 102 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 103 | 103 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 107 | 107 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 109 | 109 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 110 | 110 | -| test.c:94:11:94:16 | r13_5(int) = CompareNE r13_3, r13_4 | test.c:94:16:94:16 | r13_4(int) = Constant[0] | == | test.c:94:11:94:11 | r13_3(int) = Load r13_2, m13_0 | 0 | 113 | 113 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | < | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 103 | 103 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | >= | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 70 | 70 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | >= | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 107 | 107 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | >= | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 109 | 109 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | >= | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 110 | 110 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | >= | test.c:102:20:102:21 | r16_5(int) = Constant[10] | 0 | 113 | 113 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | < | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 70 | 70 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | < | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 107 | 107 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | < | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 109 | 109 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | < | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 110 | 110 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | < | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 113 | 113 | -| test.c:102:16:102:21 | r16_6(int) = CompareLT r16_4, r16_5 | test.c:102:20:102:21 | r16_5(int) = Constant[10] | >= | test.c:102:16:102:16 | r16_4(int) = Load r16_3, m16_0 | 1 | 103 | 103 | -| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | test.c:109:9:109:9 | r2_7(int) = Load r2_6, m13_0 | != | test.c:109:14:109:14 | r2_8(int) = Constant[0] | 0 | 109 | 109 | -| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | test.c:109:9:109:9 | r2_7(int) = Load r2_6, m13_0 | != | test.c:109:14:109:14 | r2_8(int) = Constant[0] | 0 | 113 | 113 | -| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | test.c:109:14:109:14 | r2_8(int) = Constant[0] | != | test.c:109:9:109:9 | r2_7(int) = Load r2_6, m13_0 | 0 | 109 | 109 | -| test.c:109:9:109:14 | r2_9(int) = CompareEQ r2_7, r2_8 | test.c:109:14:109:14 | r2_8(int) = Constant[0] | != | test.c:109:9:109:9 | r2_7(int) = Load r2_6, m13_0 | 0 | 113 | 113 | -| test.c:109:19:109:23 | r3_3(int) = CompareLT r3_1, r3_2 | test.c:109:19:109:19 | r3_1(long) = Load r3_0, m16_2 | >= | test.c:109:23:109:23 | r3_2(long) = Constant[0] | 0 | 113 | 113 | -| test.c:109:19:109:23 | r3_3(int) = CompareLT r3_1, r3_2 | test.c:109:23:109:23 | r3_2(long) = Constant[0] | < | test.c:109:19:109:19 | r3_1(long) = Load r3_0, m16_2 | 1 | 113 | 113 | -| test.cpp:18:8:18:12 | r0_7(bool) = CompareNE r0_5, r0_6 | test.cpp:18:8:18:10 | r0_5(X *) = Call r0_4, this:r0_3 | != | test.cpp:18:8:18:12 | r0_6(X *) = Constant[0] | 0 | 0 | 0 | -| test.cpp:18:8:18:12 | r0_7(bool) = CompareNE r0_5, r0_6 | test.cpp:18:8:18:12 | r0_6(X *) = Constant[0] | != | test.cpp:18:8:18:10 | r0_5(X *) = Call r0_4, this:r0_3 | 0 | 0 | 0 | -| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | != | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | 0 | 34 | 34 | -| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | == | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | 0 | 30 | 30 | -| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | == | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | 0 | 32 | 32 | -| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | != | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | 0 | 34 | 34 | -| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | == | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | 0 | 30 | 30 | -| test.cpp:31:7:31:13 | r0_7(bool) = CompareEQ r0_5, r0_6 | test.cpp:31:12:31:13 | r0_6(int) = Constant[-1] | == | test.cpp:31:7:31:7 | r0_5(int) = Load r0_4, m0_3 | 0 | 32 | 32 | +| test.c:7:9:7:13 | CompareGT: ... > ... | test.c:7:9:7:9 | Load: x | < | test.c:7:13:7:13 | Constant: 0 | 1 | 11 | 11 | +| test.c:7:9:7:13 | CompareGT: ... > ... | test.c:7:9:7:9 | Load: x | >= | test.c:7:13:7:13 | Constant: 0 | 1 | 8 | 8 | +| test.c:7:9:7:13 | CompareGT: ... > ... | test.c:7:13:7:13 | Constant: 0 | < | test.c:7:9:7:9 | Load: x | 0 | 8 | 8 | +| test.c:7:9:7:13 | CompareGT: ... > ... | test.c:7:13:7:13 | Constant: 0 | >= | test.c:7:9:7:9 | Load: x | 0 | 11 | 11 | +| test.c:17:8:17:12 | CompareLT: ... < ... | test.c:17:8:17:8 | Load: x | < | test.c:17:12:17:12 | Constant: 0 | 0 | 17 | 17 | +| test.c:17:8:17:12 | CompareLT: ... < ... | test.c:17:8:17:8 | Load: x | < | test.c:17:12:17:12 | Constant: 0 | 0 | 18 | 18 | +| test.c:17:8:17:12 | CompareLT: ... < ... | test.c:17:12:17:12 | Constant: 0 | >= | test.c:17:8:17:8 | Load: x | 1 | 17 | 17 | +| test.c:17:8:17:12 | CompareLT: ... < ... | test.c:17:12:17:12 | Constant: 0 | >= | test.c:17:8:17:8 | Load: x | 1 | 18 | 18 | +| test.c:17:17:17:21 | CompareGT: ... > ... | test.c:17:17:17:17 | Load: y | >= | test.c:17:21:17:21 | Constant: (long)... | 1 | 18 | 18 | +| test.c:17:17:17:21 | CompareGT: ... > ... | test.c:17:21:17:21 | Constant: (long)... | < | test.c:17:17:17:17 | Load: y | 0 | 18 | 18 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 2 | 2 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 31 | 31 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 34 | 34 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 35 | 35 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 39 | 39 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 42 | 42 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 43 | 43 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 45 | 45 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 46 | 46 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 49 | 49 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 52 | 52 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 56 | 56 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 58 | 58 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 59 | 59 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | < | test.c:26:15:26:15 | Constant: 0 | 1 | 62 | 62 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:11:26:11 | Load: x | >= | test.c:26:15:26:15 | Constant: 0 | 1 | 27 | 27 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | < | test.c:26:11:26:11 | Load: x | 0 | 27 | 27 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 2 | 2 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 31 | 31 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 34 | 34 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 35 | 35 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 39 | 39 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 42 | 42 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 43 | 43 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 45 | 45 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 46 | 46 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 49 | 49 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 52 | 52 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 56 | 56 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 58 | 58 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 59 | 59 | +| test.c:26:11:26:15 | CompareGT: ... > ... | test.c:26:15:26:15 | Constant: 0 | >= | test.c:26:11:26:11 | Load: x | 0 | 62 | 62 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | < | test.c:34:20:34:21 | Constant: 10 | 0 | 35 | 35 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 2 | 2 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 39 | 39 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 42 | 42 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 43 | 43 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 45 | 45 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 46 | 46 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 49 | 49 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 52 | 52 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 56 | 56 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 58 | 58 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 59 | 59 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:16:34:16 | Load: j | >= | test.c:34:20:34:21 | Constant: 10 | 0 | 62 | 62 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 2 | 2 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 39 | 39 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 42 | 42 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 43 | 43 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 45 | 45 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 46 | 46 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 49 | 49 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 52 | 52 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 56 | 56 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 58 | 58 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 59 | 59 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | < | test.c:34:16:34:16 | Load: j | 1 | 62 | 62 | +| test.c:34:16:34:21 | CompareLT: ... < ... | test.c:34:20:34:21 | Constant: 10 | >= | test.c:34:16:34:16 | Load: j | 1 | 35 | 35 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:16:42:16 | Load: j | < | test.c:42:20:42:21 | Constant: 10 | 0 | 42 | 42 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:16:42:16 | Load: j | < | test.c:42:20:42:21 | Constant: 10 | 0 | 43 | 43 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:16:42:16 | Load: j | < | test.c:42:20:42:21 | Constant: 10 | 0 | 45 | 45 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:16:42:16 | Load: j | < | test.c:42:20:42:21 | Constant: 10 | 0 | 46 | 46 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:16:42:16 | Load: j | < | test.c:42:20:42:21 | Constant: 10 | 0 | 49 | 49 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:16:42:16 | Load: j | < | test.c:42:20:42:21 | Constant: 10 | 0 | 52 | 52 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:20:42:21 | Constant: 10 | >= | test.c:42:16:42:16 | Load: j | 1 | 42 | 42 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:20:42:21 | Constant: 10 | >= | test.c:42:16:42:16 | Load: j | 1 | 43 | 43 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:20:42:21 | Constant: 10 | >= | test.c:42:16:42:16 | Load: j | 1 | 45 | 45 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:20:42:21 | Constant: 10 | >= | test.c:42:16:42:16 | Load: j | 1 | 46 | 46 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:20:42:21 | Constant: 10 | >= | test.c:42:16:42:16 | Load: j | 1 | 49 | 49 | +| test.c:42:16:42:21 | CompareLT: ... < ... | test.c:42:20:42:21 | Constant: 10 | >= | test.c:42:16:42:16 | Load: j | 1 | 52 | 52 | +| test.c:44:12:44:16 | CompareGT: ... > ... | test.c:44:12:44:12 | Load: z | < | test.c:44:16:44:16 | Constant: 0 | 1 | 52 | 52 | +| test.c:44:12:44:16 | CompareGT: ... > ... | test.c:44:12:44:12 | Load: z | >= | test.c:44:16:44:16 | Constant: 0 | 1 | 45 | 45 | +| test.c:44:12:44:16 | CompareGT: ... > ... | test.c:44:12:44:12 | Load: z | >= | test.c:44:16:44:16 | Constant: 0 | 1 | 46 | 46 | +| test.c:44:12:44:16 | CompareGT: ... > ... | test.c:44:12:44:12 | Load: z | >= | test.c:44:16:44:16 | Constant: 0 | 1 | 49 | 49 | +| test.c:44:12:44:16 | CompareGT: ... > ... | test.c:44:16:44:16 | Constant: 0 | < | test.c:44:12:44:12 | Load: z | 0 | 45 | 45 | +| test.c:44:12:44:16 | CompareGT: ... > ... | test.c:44:16:44:16 | Constant: 0 | < | test.c:44:12:44:12 | Load: z | 0 | 46 | 46 | +| test.c:44:12:44:16 | CompareGT: ... > ... | test.c:44:16:44:16 | Constant: 0 | < | test.c:44:12:44:12 | Load: z | 0 | 49 | 49 | +| test.c:44:12:44:16 | CompareGT: ... > ... | test.c:44:16:44:16 | Constant: 0 | >= | test.c:44:12:44:12 | Load: z | 0 | 52 | 52 | +| test.c:45:16:45:20 | CompareGT: ... > ... | test.c:45:16:45:16 | Load: y | < | test.c:45:20:45:20 | Constant: (long)... | 1 | 49 | 49 | +| test.c:45:16:45:20 | CompareGT: ... > ... | test.c:45:16:45:16 | Load: y | >= | test.c:45:20:45:20 | Constant: (long)... | 1 | 46 | 46 | +| test.c:45:16:45:20 | CompareGT: ... > ... | test.c:45:20:45:20 | Constant: (long)... | < | test.c:45:16:45:16 | Load: y | 0 | 46 | 46 | +| test.c:45:16:45:20 | CompareGT: ... > ... | test.c:45:20:45:20 | Constant: (long)... | >= | test.c:45:16:45:16 | Load: y | 0 | 49 | 49 | +| test.c:58:9:58:14 | CompareEQ: ... == ... | test.c:58:9:58:9 | Load: x | != | test.c:58:14:58:14 | Constant: 0 | 0 | 58 | 58 | +| test.c:58:9:58:14 | CompareEQ: ... == ... | test.c:58:9:58:9 | Load: x | != | test.c:58:14:58:14 | Constant: 0 | 0 | 62 | 62 | +| test.c:58:9:58:14 | CompareEQ: ... == ... | test.c:58:14:58:14 | Constant: 0 | != | test.c:58:9:58:9 | Load: x | 0 | 58 | 58 | +| test.c:58:9:58:14 | CompareEQ: ... == ... | test.c:58:14:58:14 | Constant: 0 | != | test.c:58:9:58:9 | Load: x | 0 | 62 | 62 | +| test.c:58:19:58:23 | CompareLT: ... < ... | test.c:58:19:58:19 | Load: y | >= | test.c:58:23:58:23 | Constant: (long)... | 0 | 62 | 62 | +| test.c:58:19:58:23 | CompareLT: ... < ... | test.c:58:23:58:23 | Constant: (long)... | < | test.c:58:19:58:19 | Load: y | 1 | 62 | 62 | +| test.c:75:9:75:14 | CompareEQ: ... == ... | test.c:75:9:75:9 | Load: x | != | test.c:75:14:75:14 | Constant: 0 | 0 | 79 | 79 | +| test.c:75:9:75:14 | CompareEQ: ... == ... | test.c:75:9:75:9 | Load: x | == | test.c:75:14:75:14 | Constant: 0 | 0 | 76 | 76 | +| test.c:75:9:75:14 | CompareEQ: ... == ... | test.c:75:14:75:14 | Constant: 0 | != | test.c:75:9:75:9 | Load: x | 0 | 79 | 79 | +| test.c:75:9:75:14 | CompareEQ: ... == ... | test.c:75:14:75:14 | Constant: 0 | == | test.c:75:9:75:9 | Load: x | 0 | 76 | 76 | +| test.c:85:8:85:13 | CompareEQ: ... == ... | test.c:85:8:85:8 | Load: x | == | test.c:85:13:85:13 | Constant: 0 | 0 | 85 | 85 | +| test.c:85:8:85:13 | CompareEQ: ... == ... | test.c:85:8:85:8 | Load: x | == | test.c:85:13:85:13 | Constant: 0 | 0 | 86 | 86 | +| test.c:85:8:85:13 | CompareEQ: ... == ... | test.c:85:13:85:13 | Constant: 0 | == | test.c:85:8:85:8 | Load: x | 0 | 85 | 85 | +| test.c:85:8:85:13 | CompareEQ: ... == ... | test.c:85:13:85:13 | Constant: 0 | == | test.c:85:8:85:8 | Load: x | 0 | 86 | 86 | +| test.c:85:18:85:23 | CompareNE: ... != ... | test.c:85:18:85:18 | Load: y | != | test.c:85:23:85:23 | Constant: (long)... | 0 | 86 | 86 | +| test.c:85:18:85:23 | CompareNE: ... != ... | test.c:85:23:85:23 | Constant: (long)... | != | test.c:85:18:85:18 | Load: y | 0 | 86 | 86 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:11:94:11 | Load: x | != | test.c:94:16:94:16 | Constant: 0 | 0 | 95 | 95 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:11:94:11 | Load: x | == | test.c:94:16:94:16 | Constant: 0 | 0 | 70 | 70 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:11:94:11 | Load: x | == | test.c:94:16:94:16 | Constant: 0 | 0 | 99 | 99 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:11:94:11 | Load: x | == | test.c:94:16:94:16 | Constant: 0 | 0 | 102 | 102 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:11:94:11 | Load: x | == | test.c:94:16:94:16 | Constant: 0 | 0 | 103 | 103 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:11:94:11 | Load: x | == | test.c:94:16:94:16 | Constant: 0 | 0 | 107 | 107 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:11:94:11 | Load: x | == | test.c:94:16:94:16 | Constant: 0 | 0 | 109 | 109 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:11:94:11 | Load: x | == | test.c:94:16:94:16 | Constant: 0 | 0 | 110 | 110 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:11:94:11 | Load: x | == | test.c:94:16:94:16 | Constant: 0 | 0 | 113 | 113 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:16:94:16 | Constant: 0 | != | test.c:94:11:94:11 | Load: x | 0 | 95 | 95 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:16:94:16 | Constant: 0 | == | test.c:94:11:94:11 | Load: x | 0 | 70 | 70 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:16:94:16 | Constant: 0 | == | test.c:94:11:94:11 | Load: x | 0 | 99 | 99 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:16:94:16 | Constant: 0 | == | test.c:94:11:94:11 | Load: x | 0 | 102 | 102 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:16:94:16 | Constant: 0 | == | test.c:94:11:94:11 | Load: x | 0 | 103 | 103 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:16:94:16 | Constant: 0 | == | test.c:94:11:94:11 | Load: x | 0 | 107 | 107 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:16:94:16 | Constant: 0 | == | test.c:94:11:94:11 | Load: x | 0 | 109 | 109 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:16:94:16 | Constant: 0 | == | test.c:94:11:94:11 | Load: x | 0 | 110 | 110 | +| test.c:94:11:94:16 | CompareNE: ... != ... | test.c:94:16:94:16 | Constant: 0 | == | test.c:94:11:94:11 | Load: x | 0 | 113 | 113 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:16:102:16 | Load: j | < | test.c:102:20:102:21 | Constant: 10 | 0 | 103 | 103 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:16:102:16 | Load: j | >= | test.c:102:20:102:21 | Constant: 10 | 0 | 70 | 70 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:16:102:16 | Load: j | >= | test.c:102:20:102:21 | Constant: 10 | 0 | 107 | 107 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:16:102:16 | Load: j | >= | test.c:102:20:102:21 | Constant: 10 | 0 | 109 | 109 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:16:102:16 | Load: j | >= | test.c:102:20:102:21 | Constant: 10 | 0 | 110 | 110 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:16:102:16 | Load: j | >= | test.c:102:20:102:21 | Constant: 10 | 0 | 113 | 113 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:20:102:21 | Constant: 10 | < | test.c:102:16:102:16 | Load: j | 1 | 70 | 70 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:20:102:21 | Constant: 10 | < | test.c:102:16:102:16 | Load: j | 1 | 107 | 107 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:20:102:21 | Constant: 10 | < | test.c:102:16:102:16 | Load: j | 1 | 109 | 109 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:20:102:21 | Constant: 10 | < | test.c:102:16:102:16 | Load: j | 1 | 110 | 110 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:20:102:21 | Constant: 10 | < | test.c:102:16:102:16 | Load: j | 1 | 113 | 113 | +| test.c:102:16:102:21 | CompareLT: ... < ... | test.c:102:20:102:21 | Constant: 10 | >= | test.c:102:16:102:16 | Load: j | 1 | 103 | 103 | +| test.c:109:9:109:14 | CompareEQ: ... == ... | test.c:109:9:109:9 | Load: x | != | test.c:109:14:109:14 | Constant: 0 | 0 | 109 | 109 | +| test.c:109:9:109:14 | CompareEQ: ... == ... | test.c:109:9:109:9 | Load: x | != | test.c:109:14:109:14 | Constant: 0 | 0 | 113 | 113 | +| test.c:109:9:109:14 | CompareEQ: ... == ... | test.c:109:14:109:14 | Constant: 0 | != | test.c:109:9:109:9 | Load: x | 0 | 109 | 109 | +| test.c:109:9:109:14 | CompareEQ: ... == ... | test.c:109:14:109:14 | Constant: 0 | != | test.c:109:9:109:9 | Load: x | 0 | 113 | 113 | +| test.c:109:19:109:23 | CompareLT: ... < ... | test.c:109:19:109:19 | Load: y | >= | test.c:109:23:109:23 | Constant: (long)... | 0 | 113 | 113 | +| test.c:109:19:109:23 | CompareLT: ... < ... | test.c:109:23:109:23 | Constant: (long)... | < | test.c:109:19:109:19 | Load: y | 1 | 113 | 113 | +| test.cpp:18:8:18:12 | CompareNE: (bool)... | test.cpp:18:8:18:10 | Call: call to get | != | test.cpp:18:8:18:12 | Constant: (bool)... | 0 | 0 | 0 | +| test.cpp:18:8:18:12 | CompareNE: (bool)... | test.cpp:18:8:18:12 | Constant: (bool)... | != | test.cpp:18:8:18:10 | Call: call to get | 0 | 0 | 0 | +| test.cpp:31:7:31:13 | CompareEQ: ... == ... | test.cpp:31:7:31:7 | Load: x | != | test.cpp:31:12:31:13 | Constant: - ... | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | CompareEQ: ... == ... | test.cpp:31:7:31:7 | Load: x | == | test.cpp:31:12:31:13 | Constant: - ... | 0 | 30 | 30 | +| test.cpp:31:7:31:13 | CompareEQ: ... == ... | test.cpp:31:7:31:7 | Load: x | == | test.cpp:31:12:31:13 | Constant: - ... | 0 | 32 | 32 | +| test.cpp:31:7:31:13 | CompareEQ: ... == ... | test.cpp:31:12:31:13 | Constant: - ... | != | test.cpp:31:7:31:7 | Load: x | 0 | 34 | 34 | +| test.cpp:31:7:31:13 | CompareEQ: ... == ... | test.cpp:31:12:31:13 | Constant: - ... | == | test.cpp:31:7:31:7 | Load: x | 0 | 30 | 30 | +| test.cpp:31:7:31:13 | CompareEQ: ... == ... | test.cpp:31:12:31:13 | Constant: - ... | == | test.cpp:31:7:31:7 | Load: x | 0 | 32 | 32 | From 8cc7f5c24259d7a96efc6d1a99f3d25f60f3e7be Mon Sep 17 00:00:00 2001 From: Max Schaefer Date: Mon, 1 Oct 2018 08:50:53 +0100 Subject: [PATCH 33/33] JavaScript: Update model of `DOMException`. cf. https://developer.mozilla.org/en-US/docs/Web/API/DOMException/DOMException --- javascript/externs/web/w3c_dom1.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/javascript/externs/web/w3c_dom1.js b/javascript/externs/web/w3c_dom1.js index 6f43c00a3efc..bf85793fec6b 100644 --- a/javascript/externs/web/w3c_dom1.js +++ b/javascript/externs/web/w3c_dom1.js @@ -25,9 +25,11 @@ /** * @constructor + * @param {string=} message + * @param {string=} message * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core.html#ID-17189187 */ -function DOMException() {} +function DOMException(message, name) {} /** * @type {number}