Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 17e1434

Browse files
author
Robert Marsh
committed
C++: sanity test for identical Chi node operands
1 parent 3377f88 commit 17e1434

10 files changed

Lines changed: 34 additions & 0 deletions

File tree

cpp/ql/src/semmle/code/cpp/ir/implementation/aliased_ssa/Instruction.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ module InstructionSanity {
120120
)
121121
}
122122

123+
query predicate duplicateChiOperand(ChiInstruction chi) {
124+
chi.getTotal() = chi.getPartial()
125+
}
126+
123127
/**
124128
* Holds if an instruction, other than `ExitFunction`, has no successors.
125129
*/

cpp/ql/src/semmle/code/cpp/ir/implementation/raw/Instruction.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ module InstructionSanity {
120120
)
121121
}
122122

123+
query predicate duplicateChiOperand(ChiInstruction chi) {
124+
chi.getTotal() = chi.getPartial()
125+
}
126+
123127
/**
124128
* Holds if an instruction, other than `ExitFunction`, has no successors.
125129
*/

cpp/ql/src/semmle/code/cpp/ir/implementation/unaliased_ssa/Instruction.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ module InstructionSanity {
120120
)
121121
}
122122

123+
query predicate duplicateChiOperand(ChiInstruction chi) {
124+
chi.getTotal() = chi.getPartial()
125+
}
126+
123127
/**
124128
* Holds if an instruction, other than `ExitFunction`, has no successors.
125129
*/

cpp/ql/test/library-tests/ir/ir/aliased_ssa_sanity.expected

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ unexpectedOperand
77
duplicateOperand
88
missingPhiOperand
99
missingOperandType
10+
duplicateChiOperand
11+
| ir.cpp:1035:3:1035:12 | Chi: (const lambda [] type at line 1034, col. 21)... |
12+
| ir.cpp:1039:3:1039:21 | Chi: (const lambda [] type at line 1038, col. 30)... |
13+
| ir.cpp:1043:3:1043:23 | Chi: (const lambda [] type at line 1042, col. 32)... |
14+
| ir.cpp:1046:3:1046:14 | Chi: (const lambda [] type at line 1045, col. 23)... |
1015
instructionWithoutSuccessor
1116
ambiguousSuccessors
1217
unexplainedLoop

cpp/ql/test/library-tests/ir/ir/raw_sanity.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ unexpectedOperand
77
duplicateOperand
88
missingPhiOperand
99
missingOperandType
10+
duplicateChiOperand
1011
instructionWithoutSuccessor
1112
ambiguousSuccessors
1213
unexplainedLoop

cpp/ql/test/library-tests/ir/ir/unaliased_ssa_sanity.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ unexpectedOperand
77
duplicateOperand
88
missingPhiOperand
99
missingOperandType
10+
duplicateChiOperand
1011
instructionWithoutSuccessor
1112
ambiguousSuccessors
1213
unexplainedLoop

cpp/ql/test/library-tests/ir/ssa/aliased_ssa_sanity.expected

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ unexpectedOperand
33
duplicateOperand
44
missingPhiOperand
55
missingOperandType
6+
duplicateChiOperand
7+
| ssa.cpp:220:19:220:20 | Chi: call to Constructible |
8+
| ssa.cpp:221:3:221:3 | Chi: c |
9+
| ssa.cpp:222:3:222:3 | Chi: c |
10+
| ssa.cpp:223:21:223:37 | Chi: call to Constructible |
11+
| ssa.cpp:224:3:224:4 | Chi: c2 |
612
instructionWithoutSuccessor
713
ambiguousSuccessors
814
unexplainedLoop

cpp/ql/test/library-tests/ir/ssa/unaliased_ssa_sanity.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ unexpectedOperand
33
duplicateOperand
44
missingPhiOperand
55
missingOperandType
6+
duplicateChiOperand
67
instructionWithoutSuccessor
78
ambiguousSuccessors
89
unexplainedLoop

csharp/ql/src/semmle/code/csharp/ir/implementation/raw/Instruction.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ module InstructionSanity {
120120
)
121121
}
122122

123+
query predicate duplicateChiOperand(ChiInstruction chi) {
124+
chi.getTotal() = chi.getPartial()
125+
}
126+
123127
/**
124128
* Holds if an instruction, other than `ExitFunction`, has no successors.
125129
*/

csharp/ql/src/semmle/code/csharp/ir/implementation/unaliased_ssa/Instruction.qll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@ module InstructionSanity {
120120
)
121121
}
122122

123+
query predicate duplicateChiOperand(ChiInstruction chi) {
124+
chi.getTotal() = chi.getPartial()
125+
}
126+
123127
/**
124128
* Holds if an instruction, other than `ExitFunction`, has no successors.
125129
*/

0 commit comments

Comments
 (0)