mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
C++: Add testcases that produces an 'missingOperandType' and 'missingPhiOperand' consistency errors.
This commit is contained in:
@@ -2276,6 +2276,56 @@ destructors_for_temps.cpp:
|
||||
# 72| getQualifier(): [ReuseExpr] reuse of temporary object
|
||||
# 72| Type = [SpecifiedType] const string
|
||||
# 72| ValueCategory = xvalue
|
||||
# 75| [TopLevelFunction] ClassWithDestructor2 make()
|
||||
# 75| <params>:
|
||||
# 77| [TopLevelFunction] void temp_test9()
|
||||
# 77| <params>:
|
||||
# 77| getEntryPoint(): [BlockStmt] { ... }
|
||||
# 78| getStmt(0): [ExprStmt] ExprStmt
|
||||
# 78| getExpr(): [FunctionCall] call to make
|
||||
# 78| Type = [Class] ClassWithDestructor2
|
||||
# 78| ValueCategory = prvalue
|
||||
# 78| getImplicitDestructorCall(0): [DestructorCall] call to ~ClassWithDestructor2
|
||||
# 78| Type = [VoidType] void
|
||||
# 78| ValueCategory = prvalue
|
||||
# 78| getQualifier(): [ReuseExpr] reuse of temporary object
|
||||
# 78| Type = [Class] ClassWithDestructor2
|
||||
# 78| ValueCategory = xvalue
|
||||
# 78| getExpr().getFullyConverted(): [TemporaryObjectExpr] temporary object
|
||||
# 78| Type = [Class] ClassWithDestructor2
|
||||
# 78| ValueCategory = prvalue
|
||||
# 79| getStmt(1): [ReturnStmt] return ...
|
||||
# 81| [TopLevelFunction] void temp_test10(int)
|
||||
# 81| <params>:
|
||||
# 81| getParameter(0): [Parameter] i
|
||||
# 81| Type = [IntType] int
|
||||
# 81| getEntryPoint(): [BlockStmt] { ... }
|
||||
# 82| getStmt(0): [WhileStmt] while (...) ...
|
||||
# 82| getCondition(): [LTExpr] ... < ...
|
||||
# 82| Type = [BoolType] bool
|
||||
# 82| ValueCategory = prvalue
|
||||
# 82| getLesserOperand(): [VariableAccess] i
|
||||
# 82| Type = [IntType] int
|
||||
# 82| ValueCategory = prvalue(load)
|
||||
# 82| getGreaterOperand(): [Literal] 10
|
||||
# 82| Type = [IntType] int
|
||||
# 82| Value = [Literal] 10
|
||||
# 82| ValueCategory = prvalue
|
||||
# 82| getStmt(): [BlockStmt] { ... }
|
||||
# 83| getStmt(0): [ExprStmt] ExprStmt
|
||||
# 83| getExpr(): [FunctionCall] call to make
|
||||
# 83| Type = [Class] ClassWithDestructor2
|
||||
# 83| ValueCategory = prvalue
|
||||
# 83| getImplicitDestructorCall(0): [DestructorCall] call to ~ClassWithDestructor2
|
||||
# 83| Type = [VoidType] void
|
||||
# 83| ValueCategory = prvalue
|
||||
# 83| getQualifier(): [ReuseExpr] reuse of temporary object
|
||||
# 83| Type = [Class] ClassWithDestructor2
|
||||
# 83| ValueCategory = xvalue
|
||||
# 83| getExpr().getFullyConverted(): [TemporaryObjectExpr] temporary object
|
||||
# 83| Type = [Class] ClassWithDestructor2
|
||||
# 83| ValueCategory = prvalue
|
||||
# 85| getStmt(1): [ReturnStmt] return ...
|
||||
ir.c:
|
||||
# 5| [TopLevelFunction] int getX(MyCoords*)
|
||||
# 5| <params>:
|
||||
|
||||
@@ -1434,6 +1434,75 @@ destructors_for_temps.cpp:
|
||||
#-----| False -> Block 1
|
||||
#-----| True -> Block 3
|
||||
|
||||
# 77| void temp_test9()
|
||||
# 77| Block 0
|
||||
# 77| v77_1(void) = EnterFunction :
|
||||
# 77| m77_2(unknown) = AliasedDefinition :
|
||||
# 77| m77_3(unknown) = InitializeNonLocal :
|
||||
# 77| m77_4(unknown) = Chi : total:m77_2, partial:m77_3
|
||||
# 78| r78_1(glval<ClassWithDestructor2>) = VariableAddress[#temp78:5] :
|
||||
# 78| r78_2(glval<unknown>) = FunctionAddress[make] :
|
||||
# 78| r78_3(ClassWithDestructor2) = Call[make] : func:r78_2
|
||||
# 78| m78_4(unknown) = ^CallSideEffect : ~m77_4
|
||||
# 78| m78_5(unknown) = Chi : total:m77_4, partial:m78_4
|
||||
# 78| r78_6(glval<ClassWithDestructor2>) = CopyValue : r78_1
|
||||
# 78| r78_7(glval<unknown>) = FunctionAddress[~ClassWithDestructor2] :
|
||||
# 78| v78_8(void) = Call[~ClassWithDestructor2] : func:r78_7, this:r78_6
|
||||
# 78| m78_9(unknown) = ^CallSideEffect : ~m78_5
|
||||
# 78| m78_10(unknown) = Chi : total:m78_5, partial:m78_9
|
||||
# 78| v78_11(void) = ^IndirectReadSideEffect[-1] : &:r78_6, ~m?
|
||||
# 78| m78_12(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r78_6
|
||||
# 78| m78_13(ClassWithDestructor2) = Chi : total:~m?, partial:m78_12
|
||||
# 78| m78_14(ClassWithDestructor2) = Store[#temp78:5] : &:r78_1, r78_3
|
||||
# 79| v79_1(void) = NoOp :
|
||||
# 77| v77_5(void) = ReturnVoid :
|
||||
# 77| v77_6(void) = AliasedUse : ~m78_10
|
||||
# 77| v77_7(void) = ExitFunction :
|
||||
|
||||
# 81| void temp_test10(int)
|
||||
# 81| Block 0
|
||||
# 81| v81_1(void) = EnterFunction :
|
||||
# 81| m81_2(unknown) = AliasedDefinition :
|
||||
# 81| m81_3(unknown) = InitializeNonLocal :
|
||||
# 81| m81_4(unknown) = Chi : total:m81_2, partial:m81_3
|
||||
# 81| r81_5(glval<int>) = VariableAddress[i] :
|
||||
# 81| m81_6(int) = InitializeParameter[i] : &:r81_5
|
||||
#-----| Goto -> Block 1
|
||||
|
||||
# 82| Block 1
|
||||
# 82| m82_1(ClassWithDestructor2) = Phi : from 2:m83_14
|
||||
# 82| m82_2(unknown) = Phi : from 0:~m81_4, from 2:~m83_10
|
||||
# 82| r82_3(glval<int>) = VariableAddress[i] :
|
||||
# 82| r82_4(int) = Load[i] : &:r82_3, m81_6
|
||||
# 82| r82_5(int) = Constant[10] :
|
||||
# 82| r82_6(bool) = CompareLT : r82_4, r82_5
|
||||
# 82| v82_7(void) = ConditionalBranch : r82_6
|
||||
#-----| False -> Block 3
|
||||
#-----| True -> Block 2
|
||||
|
||||
# 83| Block 2
|
||||
# 83| r83_1(glval<ClassWithDestructor2>) = VariableAddress[#temp83:9] :
|
||||
# 83| r83_2(glval<unknown>) = FunctionAddress[make] :
|
||||
# 83| r83_3(ClassWithDestructor2) = Call[make] : func:r83_2
|
||||
# 83| m83_4(unknown) = ^CallSideEffect : ~m82_2
|
||||
# 83| m83_5(unknown) = Chi : total:m82_2, partial:m83_4
|
||||
# 83| r83_6(glval<ClassWithDestructor2>) = CopyValue : r83_1
|
||||
# 83| r83_7(glval<unknown>) = FunctionAddress[~ClassWithDestructor2] :
|
||||
# 83| v83_8(void) = Call[~ClassWithDestructor2] : func:r83_7, this:r83_6
|
||||
# 83| m83_9(unknown) = ^CallSideEffect : ~m83_5
|
||||
# 83| m83_10(unknown) = Chi : total:m83_5, partial:m83_9
|
||||
# 83| v83_11(void) = ^IndirectReadSideEffect[-1] : &:r83_6, m82_1
|
||||
# 83| m83_12(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r83_6
|
||||
# 83| m83_13(ClassWithDestructor2) = Chi : total:m82_1, partial:m83_12
|
||||
# 83| m83_14(ClassWithDestructor2) = Store[#temp83:9] : &:r83_1, r83_3
|
||||
#-----| Goto (back edge) -> Block 1
|
||||
|
||||
# 85| Block 3
|
||||
# 85| v85_1(void) = NoOp :
|
||||
# 81| v81_7(void) = ReturnVoid :
|
||||
# 81| v81_8(void) = AliasedUse : ~m82_2
|
||||
# 81| v81_9(void) = ExitFunction :
|
||||
|
||||
ir.c:
|
||||
# 7| void MyCoordsTest(int)
|
||||
# 7| Block 0
|
||||
|
||||
@@ -2,8 +2,10 @@ missingOperand
|
||||
unexpectedOperand
|
||||
duplicateOperand
|
||||
missingPhiOperand
|
||||
| destructors_for_temps.cpp:82:11:82:11 | Phi: i | Instruction 'Phi: i' is missing an operand for predecessor block 'EnterFunction: temp_test10' in function '$@'. | destructors_for_temps.cpp:81:6:81:16 | void temp_test10(int) | void temp_test10(int) |
|
||||
missingOperandType
|
||||
| destructors_for_temps.cpp:39:3:39:53 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | destructors_for_temps.cpp:38:6:38:15 | void temp_test5(bool) | void temp_test5(bool) |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | destructors_for_temps.cpp:77:6:77:15 | void temp_test9() | void temp_test9() |
|
||||
| ir.cpp:1425:5:1425:30 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1414:6:1414:21 | void temporary_string() | void temporary_string() |
|
||||
| ir.cpp:1437:5:1437:39 | ChiTotal | Operand 'ChiTotal' of instruction 'Chi' is missing a type in function '$@'. | ir.cpp:1428:6:1428:30 | void temporary_destructor_only() | void temporary_destructor_only() |
|
||||
duplicateChiOperand
|
||||
|
||||
@@ -70,4 +70,16 @@ bool const_ref_string(const string &);
|
||||
bool conditional_temp_via_conjunction(bool b)
|
||||
{
|
||||
return b && const_ref_string("");
|
||||
}
|
||||
|
||||
ClassWithDestructor2 make();
|
||||
|
||||
void temp_test9() {
|
||||
make();
|
||||
}
|
||||
|
||||
void temp_test10(int i) {
|
||||
while(i < 10) {
|
||||
make();
|
||||
}
|
||||
}
|
||||
@@ -1284,6 +1284,55 @@
|
||||
| destructors_for_temps.cpp:72:34:72:35 | SideEffect | ~m72_28 |
|
||||
| destructors_for_temps.cpp:72:34:72:35 | Unary | r72_18 |
|
||||
| destructors_for_temps.cpp:72:34:72:35 | Unary | r72_21 |
|
||||
| destructors_for_temps.cpp:77:6:77:15 | ChiPartial | partial:m77_3 |
|
||||
| destructors_for_temps.cpp:77:6:77:15 | ChiTotal | total:m77_2 |
|
||||
| destructors_for_temps.cpp:77:6:77:15 | SideEffect | ~m78_10 |
|
||||
| destructors_for_temps.cpp:78:5:78:8 | CallTarget | func:r78_2 |
|
||||
| destructors_for_temps.cpp:78:5:78:8 | ChiPartial | partial:m78_4 |
|
||||
| destructors_for_temps.cpp:78:5:78:8 | ChiTotal | total:m77_4 |
|
||||
| destructors_for_temps.cpp:78:5:78:8 | SideEffect | ~m77_4 |
|
||||
| destructors_for_temps.cpp:78:5:78:8 | StoreValue | r78_3 |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | Address | &:r78_1 |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | Address | &:r78_6 |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | Address | &:r78_6 |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | Arg(this) | this:r78_6 |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | CallTarget | func:r78_7 |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | ChiPartial | partial:m78_9 |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | ChiPartial | partial:m78_12 |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | ChiTotal | total:m78_5 |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | ChiTotal | total:~m? |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | SideEffect | ~m78_5 |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | SideEffect | ~m? |
|
||||
| destructors_for_temps.cpp:78:5:78:10 | Unary | r78_1 |
|
||||
| destructors_for_temps.cpp:81:6:81:16 | ChiPartial | partial:m81_3 |
|
||||
| destructors_for_temps.cpp:81:6:81:16 | ChiTotal | total:m81_2 |
|
||||
| destructors_for_temps.cpp:81:6:81:16 | SideEffect | ~m82_2 |
|
||||
| destructors_for_temps.cpp:81:22:81:22 | Address | &:r81_5 |
|
||||
| destructors_for_temps.cpp:82:11:82:11 | Address | &:r82_3 |
|
||||
| destructors_for_temps.cpp:82:11:82:11 | Left | r82_4 |
|
||||
| destructors_for_temps.cpp:82:11:82:11 | Load | m81_6 |
|
||||
| destructors_for_temps.cpp:82:11:82:11 | Phi | from 0:~m81_4 |
|
||||
| destructors_for_temps.cpp:82:11:82:11 | Phi | from 2:m83_14 |
|
||||
| destructors_for_temps.cpp:82:11:82:11 | Phi | from 2:~m83_10 |
|
||||
| destructors_for_temps.cpp:82:11:82:16 | Condition | r82_6 |
|
||||
| destructors_for_temps.cpp:82:15:82:16 | Right | r82_5 |
|
||||
| destructors_for_temps.cpp:83:9:83:12 | CallTarget | func:r83_2 |
|
||||
| destructors_for_temps.cpp:83:9:83:12 | ChiPartial | partial:m83_4 |
|
||||
| destructors_for_temps.cpp:83:9:83:12 | ChiTotal | total:m82_2 |
|
||||
| destructors_for_temps.cpp:83:9:83:12 | SideEffect | ~m82_2 |
|
||||
| destructors_for_temps.cpp:83:9:83:12 | StoreValue | r83_3 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | Address | &:r83_1 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | Address | &:r83_6 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | Address | &:r83_6 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | Arg(this) | this:r83_6 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | CallTarget | func:r83_7 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | ChiPartial | partial:m83_9 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | ChiPartial | partial:m83_12 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | ChiTotal | total:m82_1 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | ChiTotal | total:m83_5 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | SideEffect | m82_1 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | SideEffect | ~m83_5 |
|
||||
| destructors_for_temps.cpp:83:9:83:14 | Unary | r83_1 |
|
||||
| file://:0:0:0:0 | Address | &:r0_1 |
|
||||
| file://:0:0:0:0 | Address | &:r0_1 |
|
||||
| file://:0:0:0:0 | Address | &:r0_1 |
|
||||
|
||||
@@ -1306,6 +1306,65 @@ destructors_for_temps.cpp:
|
||||
#-----| False -> Block 1
|
||||
#-----| True -> Block 3
|
||||
|
||||
# 77| void temp_test9()
|
||||
# 77| Block 0
|
||||
# 77| v77_1(void) = EnterFunction :
|
||||
# 77| mu77_2(unknown) = AliasedDefinition :
|
||||
# 77| mu77_3(unknown) = InitializeNonLocal :
|
||||
# 78| r78_1(glval<ClassWithDestructor2>) = VariableAddress[#temp78:5] :
|
||||
# 78| r78_2(glval<unknown>) = FunctionAddress[make] :
|
||||
# 78| r78_3(ClassWithDestructor2) = Call[make] : func:r78_2
|
||||
# 78| mu78_4(unknown) = ^CallSideEffect : ~m?
|
||||
# 78| r78_5(glval<ClassWithDestructor2>) = CopyValue : r78_1
|
||||
# 78| r78_6(glval<unknown>) = FunctionAddress[~ClassWithDestructor2] :
|
||||
# 78| v78_7(void) = Call[~ClassWithDestructor2] : func:r78_6, this:r78_5
|
||||
# 78| mu78_8(unknown) = ^CallSideEffect : ~m?
|
||||
# 78| v78_9(void) = ^IndirectReadSideEffect[-1] : &:r78_5, ~m?
|
||||
# 78| mu78_10(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r78_5
|
||||
# 78| mu78_11(ClassWithDestructor2) = Store[#temp78:5] : &:r78_1, r78_3
|
||||
# 79| v79_1(void) = NoOp :
|
||||
# 77| v77_4(void) = ReturnVoid :
|
||||
# 77| v77_5(void) = AliasedUse : ~m?
|
||||
# 77| v77_6(void) = ExitFunction :
|
||||
|
||||
# 81| void temp_test10(int)
|
||||
# 81| Block 0
|
||||
# 81| v81_1(void) = EnterFunction :
|
||||
# 81| mu81_2(unknown) = AliasedDefinition :
|
||||
# 81| mu81_3(unknown) = InitializeNonLocal :
|
||||
# 81| r81_4(glval<int>) = VariableAddress[i] :
|
||||
# 81| mu81_5(int) = InitializeParameter[i] : &:r81_4
|
||||
#-----| Goto -> Block 1
|
||||
|
||||
# 82| Block 1
|
||||
# 82| r82_1(glval<int>) = VariableAddress[i] :
|
||||
# 82| r82_2(int) = Load[i] : &:r82_1, ~m?
|
||||
# 82| r82_3(int) = Constant[10] :
|
||||
# 82| r82_4(bool) = CompareLT : r82_2, r82_3
|
||||
# 82| v82_5(void) = ConditionalBranch : r82_4
|
||||
#-----| False -> Block 3
|
||||
#-----| True -> Block 2
|
||||
|
||||
# 83| Block 2
|
||||
# 83| r83_1(glval<ClassWithDestructor2>) = VariableAddress[#temp83:9] :
|
||||
# 83| r83_2(glval<unknown>) = FunctionAddress[make] :
|
||||
# 83| r83_3(ClassWithDestructor2) = Call[make] : func:r83_2
|
||||
# 83| mu83_4(unknown) = ^CallSideEffect : ~m?
|
||||
# 83| r83_5(glval<ClassWithDestructor2>) = CopyValue : r83_1
|
||||
# 83| r83_6(glval<unknown>) = FunctionAddress[~ClassWithDestructor2] :
|
||||
# 83| v83_7(void) = Call[~ClassWithDestructor2] : func:r83_6, this:r83_5
|
||||
# 83| mu83_8(unknown) = ^CallSideEffect : ~m?
|
||||
# 83| v83_9(void) = ^IndirectReadSideEffect[-1] : &:r83_5, ~m?
|
||||
# 83| mu83_10(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r83_5
|
||||
# 83| mu83_11(ClassWithDestructor2) = Store[#temp83:9] : &:r83_1, r83_3
|
||||
#-----| Goto (back edge) -> Block 1
|
||||
|
||||
# 85| Block 3
|
||||
# 85| v85_1(void) = NoOp :
|
||||
# 81| v81_6(void) = ReturnVoid :
|
||||
# 81| v81_7(void) = AliasedUse : ~m?
|
||||
# 81| v81_8(void) = ExitFunction :
|
||||
|
||||
ir.c:
|
||||
# 7| void MyCoordsTest(int)
|
||||
# 7| Block 0
|
||||
|
||||
Reference in New Issue
Block a user