Skip to content

Commit dfa1642

Browse files
committed
C++: Add IR inconsistency test
1 parent 6e0b5bc commit dfa1642

9 files changed

+49
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4595,6 +4595,18 @@ ir.c:
45954595
# 76| Value = [Literal] 0
45964596
# 76| ValueCategory = prvalue
45974597
# 78| getStmt(1): [ReturnStmt] return ...
4598+
# 80| [TopLevelFunction] void raise_access_violation()
4599+
# 80| <params>:
4600+
# 80| getEntryPoint(): [BlockStmt] { ... }
4601+
# 81| getStmt(0): [ExprStmt] ExprStmt
4602+
# 81| getExpr(): [FunctionCall] call to ExRaiseAccessViolation
4603+
# 81| Type = [VoidType] void
4604+
# 81| ValueCategory = prvalue
4605+
# 81| getArgument(0): [Literal] 1
4606+
# 81| Type = [IntType] int
4607+
# 81| Value = [Literal] 1
4608+
# 81| ValueCategory = prvalue
4609+
# 82| getStmt(1): [ReturnStmt] return ...
45984610
ir.cpp:
45994611
# 1| [TopLevelFunction] void Constants()
46004612
# 1| <params>:

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,6 +3250,18 @@ ir.c:
32503250
# 73| m73_4(unknown) = ^CallSideEffect : ~m70_4
32513251
# 73| m73_5(unknown) = Chi : total:m70_4, partial:m73_4
32523252

3253+
# 80| void raise_access_violation()
3254+
# 80| Block 0
3255+
# 80| v80_1(void) = EnterFunction :
3256+
# 80| m80_2(unknown) = AliasedDefinition :
3257+
# 80| m80_3(unknown) = InitializeNonLocal :
3258+
# 80| m80_4(unknown) = Chi : total:m80_2, partial:m80_3
3259+
# 81| r81_1(glval<unknown>) = FunctionAddress[ExRaiseAccessViolation] :
3260+
# 81| r81_2(int) = Constant[1] :
3261+
# 81| v81_3(void) = Call[ExRaiseAccessViolation] : func:r81_1, 0:r81_2
3262+
# 81| m81_4(unknown) = ^CallSideEffect : ~m80_4
3263+
# 81| m81_5(unknown) = Chi : total:m80_4, partial:m81_4
3264+
32533265
ir.cpp:
32543266
# 1| void Constants()
32553267
# 1| Block 0

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ sideEffectWithoutPrimary
88
instructionWithoutSuccessor
99
| ir.c:62:5:62:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:57:6:57:30 | void throw_in_try_with_finally() | void throw_in_try_with_finally() |
1010
| ir.c:73:5:73:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() |
11+
| ir.c:81:3:81:24 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() |
1112
ambiguousSuccessors
1213
unexplainedLoop
1314
| ir.c:38:13:38:37 | Constant: 1 | Instruction 'Constant: 1' is part of an unexplained loop in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ sideEffectWithoutPrimary
88
instructionWithoutSuccessor
99
| ir.c:62:5:62:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:57:6:57:30 | void throw_in_try_with_finally() | void throw_in_try_with_finally() |
1010
| ir.c:73:5:73:26 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() |
11+
| ir.c:81:3:81:24 | Chi: call to ExRaiseAccessViolation | Instruction 'Chi: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() |
1112
ambiguousSuccessors
1213
unexplainedLoop
1314
| ir.c:38:13:38:37 | Constant: 1 | Instruction 'Constant: 1' is part of an unexplained loop in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() |

cpp/ql/test/library-tests/ir/ir/ir.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,8 @@ void throw_in_try_with_throw_in_finally()
7777
}
7878
}
7979

80+
void raise_access_violation() {
81+
ExRaiseAccessViolation(1);
82+
}
83+
8084
// semmle-extractor-options: --microsoft

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ instructionWithoutSuccessor
99
| ir.c:62:5:62:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:57:6:57:30 | void throw_in_try_with_finally() | void throw_in_try_with_finally() |
1010
| ir.c:73:5:73:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() |
1111
| ir.c:76:5:76:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() |
12+
| ir.c:81:3:81:24 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() |
1213
ambiguousSuccessors
1314
unexplainedLoop
1415
| ir.c:38:13:38:37 | Constant: 1 | Instruction 'Constant: 1' is part of an unexplained loop in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() |

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3035,6 +3035,22 @@ ir.c:
30353035
# 70| v70_5(void) = AliasedUse : ~m?
30363036
# 70| v70_6(void) = ExitFunction :
30373037

3038+
# 80| void raise_access_violation()
3039+
# 80| Block 0
3040+
# 80| v80_1(void) = EnterFunction :
3041+
# 80| mu80_2(unknown) = AliasedDefinition :
3042+
# 80| mu80_3(unknown) = InitializeNonLocal :
3043+
# 81| r81_1(glval<unknown>) = FunctionAddress[ExRaiseAccessViolation] :
3044+
# 81| r81_2(int) = Constant[1] :
3045+
# 81| v81_3(void) = Call[ExRaiseAccessViolation] : func:r81_1, 0:r81_2
3046+
# 81| mu81_4(unknown) = ^CallSideEffect : ~m?
3047+
3048+
# 82| Block 1
3049+
# 82| v82_1(void) = NoOp :
3050+
# 80| v80_4(void) = ReturnVoid :
3051+
# 80| v80_5(void) = AliasedUse : ~m?
3052+
# 80| v80_6(void) = ExitFunction :
3053+
30383054
ir.cpp:
30393055
# 1| void Constants()
30403056
# 1| Block 0

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ sideEffectWithoutPrimary
88
instructionWithoutSuccessor
99
| ir.c:62:5:62:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:57:6:57:30 | void throw_in_try_with_finally() | void throw_in_try_with_finally() |
1010
| ir.c:73:5:73:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() |
11+
| ir.c:81:3:81:24 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() |
1112
ambiguousSuccessors
1213
unexplainedLoop
1314
| ir.c:38:13:38:37 | Constant: 1 | Instruction 'Constant: 1' is part of an unexplained loop in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ sideEffectWithoutPrimary
88
instructionWithoutSuccessor
99
| ir.c:62:5:62:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:57:6:57:30 | void throw_in_try_with_finally() | void throw_in_try_with_finally() |
1010
| ir.c:73:5:73:26 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:70:6:70:39 | void throw_in_try_with_throw_in_finally() | void throw_in_try_with_throw_in_finally() |
11+
| ir.c:81:3:81:24 | CallSideEffect: call to ExRaiseAccessViolation | Instruction 'CallSideEffect: call to ExRaiseAccessViolation' has no successors in function '$@'. | ir.c:80:6:80:27 | void raise_access_violation() | void raise_access_violation() |
1112
ambiguousSuccessors
1213
unexplainedLoop
1314
| ir.c:38:13:38:37 | Constant: 1 | Instruction 'Constant: 1' is part of an unexplained loop in function '$@'. | ir.c:32:6:32:32 | void unexplained_loop_regression() | void unexplained_loop_regression() |

0 commit comments

Comments
 (0)