C++: Add a simple test that fails.

This commit is contained in:
Mathias Vorreiter Pedersen 2024-04-04 11:06:36 +01:00
Родитель cf996f8600
Коммит d4e2d37311
10 изменённых файлов: 183 добавлений и 8 удалений

Просмотреть файл

@ -2186,6 +2186,41 @@ destructors_for_temps.cpp:
# 55| Type = [Class] ClassWithDestructor2
# 55| ValueCategory = prvalue
# 56| getStmt(1): [ReturnStmt] return ...
# 58| [TopLevelFunction] void temp_test8_simple(bool)
# 58| <params>:
# 58| getParameter(0): [Parameter] b
# 58| Type = [BoolType] bool
# 58| getEntryPoint(): [BlockStmt] { ... }
# 59| getStmt(0): [ExprStmt] ExprStmt
# 59| getExpr(): [ConditionalExpr] ... ? ... : ...
# 59| Type = [PlainCharType] char
# 59| ValueCategory = prvalue
# 59| getCondition(): [VariableAccess] b
# 59| Type = [BoolType] bool
# 59| ValueCategory = prvalue(load)
# 59| getThen(): [ThrowExpr] throw ...
# 59| Type = [PlainCharType] char
# 59| ValueCategory = prvalue
# 59| getExpr(): [FunctionCall] call to get_x
# 59| Type = [PlainCharType] char
# 59| ValueCategory = prvalue
# 59| getQualifier(): [ConstructorCall] call to ClassWithDestructor2
# 59| Type = [VoidType] void
# 59| ValueCategory = prvalue
# 59| getQualifier().getFullyConverted(): [TemporaryObjectExpr] temporary object
# 59| Type = [Class] ClassWithDestructor2
# 59| ValueCategory = prvalue(load)
# 59| getElse(): [CharLiteral] 97
# 59| Type = [PlainCharType] char
# 59| Value = [CharLiteral] 97
# 59| ValueCategory = prvalue
# 59| getImplicitDestructorCall(0): [DestructorCall] call to ~ClassWithDestructor2
# 59| Type = [VoidType] void
# 59| ValueCategory = prvalue
# 59| getQualifier(): [ReuseExpr] reuse of temporary object
# 59| Type = [Class] ClassWithDestructor2
# 59| ValueCategory = xvalue
# 60| getStmt(1): [ReturnStmt] return ...
ir.c:
# 5| [TopLevelFunction] int getX(MyCoords*)
# 5| <params>:

Просмотреть файл

@ -1252,12 +1252,12 @@ destructors_for_temps.cpp:
# 51| v51_85(void) = ^IndirectReadSideEffect[-1] : &:r51_58, &:r51_80, m51_44, m51_47, m51_66, m51_69
# 51| m51_86(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r51_58, &:r51_80
# 51| m51_87(ClassWithDestructor2) = Chi : total:m51_44, total:m51_47, total:m51_66, total:m51_69, partial:m51_64, partial:m51_86
#-----| Goto (back edge) -> Block 3
#-----| Goto (back edge) -> Block 4
#-----| Goto (back edge) -> Block 3
# 51| Block 8
#-----| Goto (back edge) -> Block 3
#-----| Goto (back edge) -> Block 4
#-----| Goto (back edge) -> Block 3
# 54| void temp_test8(bool)
# 54| Block 0
@ -1358,12 +1358,59 @@ destructors_for_temps.cpp:
# 55| v55_85(void) = ^IndirectReadSideEffect[-1] : &:r55_58, &:r55_80, m55_45, m55_48, m55_67, m55_70
# 55| m55_86(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r55_58, &:r55_80
# 55| m55_87(ClassWithDestructor2) = Chi : total:m55_45, total:m55_48, total:m55_67, total:m55_70, partial:m55_64, partial:m55_86
#-----| Goto (back edge) -> Block 3
#-----| Goto (back edge) -> Block 4
#-----| Goto (back edge) -> Block 3
# 55| Block 8
#-----| Goto (back edge) -> Block 3
#-----| Goto (back edge) -> Block 4
#-----| Goto (back edge) -> Block 3
# 58| void temp_test8_simple(bool)
# 58| Block 0
# 58| v58_1(void) = EnterFunction :
# 58| m58_2(unknown) = AliasedDefinition :
# 58| m58_3(unknown) = InitializeNonLocal :
# 58| m58_4(unknown) = Chi : total:m58_2, partial:m58_3
# 58| r58_5(glval<bool>) = VariableAddress[b] :
# 58| m58_6(bool) = InitializeParameter[b] : &:r58_5
# 59| r59_1(glval<bool>) = VariableAddress[b] :
# 59| r59_2(bool) = Load[b] : &:r59_1, m58_6
# 59| v59_3(void) = ConditionalBranch : r59_2
#-----| False -> Block 3
#-----| True -> Block 2
# 58| Block 1
# 58| v58_7(void) = Unwind :
# 58| v58_8(void) = AliasedUse : ~m59_16
# 58| v58_9(void) = ExitFunction :
# 59| Block 2
# 59| r59_4(glval<char>) = VariableAddress[#throw59:9] :
# 59| r59_5(glval<ClassWithDestructor2>) = VariableAddress[#temp59:15] :
# 59| m59_6(ClassWithDestructor2) = Uninitialized[#temp59:15] : &:r59_5
# 59| r59_7(glval<unknown>) = FunctionAddress[ClassWithDestructor2] :
# 59| v59_8(void) = Call[ClassWithDestructor2] : func:r59_7, this:r59_5
# 59| m59_9(unknown) = ^CallSideEffect : ~m58_4
# 59| m59_10(unknown) = Chi : total:m58_4, partial:m59_9
# 59| m59_11(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r59_5
# 59| m59_12(ClassWithDestructor2) = Chi : total:m59_6, partial:m59_11
# 59| r59_13(glval<unknown>) = FunctionAddress[get_x] :
# 59| r59_14(char) = Call[get_x] : func:r59_13, this:r59_5
# 59| m59_15(unknown) = ^CallSideEffect : ~m59_10
# 59| m59_16(unknown) = Chi : total:m59_10, partial:m59_15
# 59| v59_17(void) = ^IndirectReadSideEffect[-1] : &:r59_5, m59_12
# 59| m59_18(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r59_5
# 59| m59_19(ClassWithDestructor2) = Chi : total:m59_12, partial:m59_18
# 59| m59_20(char) = Store[#throw59:9] : &:r59_4, r59_14
# 59| v59_21(void) = ThrowValue : &:r59_4, m59_20
#-----| Exception -> Block 1
# 59| Block 3
# 59| r59_22(char) = Constant[97] :
# 59| r59_23(glval<char>) = VariableAddress[#temp59:5] :
# 59| m59_24(char) = Store[#temp59:5] : &:r59_23, r59_22
# 59| r59_25(glval<char>) = VariableAddress[#temp59:5] :
# 59| r59_26(char) = Load[#temp59:5] : &:r59_25, m59_24
ir.c:
# 7| void MyCoordsTest(int)

Просмотреть файл

@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| destructors_for_temps.cpp:59:5:59:50 | Load: ... ? ... : ... | Instruction 'Load: ... ? ... : ...' has no successors in function '$@'. | destructors_for_temps.cpp:58:6:58:22 | void temp_test8_simple(bool) | void temp_test8_simple(bool) |
ambiguousSuccessors
| destructors_for_temps.cpp:51:75:51:96 | Chi: reuse of temporary object | Instruction 'Chi: reuse of temporary object' has 2 successors of kind 'Goto' in function '$@'. | destructors_for_temps.cpp:49:6:49:15 | void temp_test7(bool) | void temp_test7(bool) |
| destructors_for_temps.cpp:55:75:55:96 | Chi: reuse of temporary object | Instruction 'Chi: reuse of temporary object' has 2 successors of kind 'Goto' in function '$@'. | destructors_for_temps.cpp:54:6:54:15 | void temp_test8(bool) | void temp_test8(bool) |

Просмотреть файл

@ -11,6 +11,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| destructors_for_temps.cpp:59:5:59:50 | Load: ... ? ... : ... | Instruction 'Load: ... ? ... : ...' has no successors in function '$@'. | destructors_for_temps.cpp:58:6:58:22 | void temp_test8_simple(bool) | void temp_test8_simple(bool) |
ambiguousSuccessors
| destructors_for_temps.cpp:51:75:51:96 | Chi: reuse of temporary object | Instruction 'Chi: reuse of temporary object' has 2 successors of kind 'Goto' in function '$@'. | destructors_for_temps.cpp:49:6:49:15 | void temp_test7(bool) | void temp_test7(bool) |
| destructors_for_temps.cpp:55:75:55:96 | Chi: reuse of temporary object | Instruction 'Chi: reuse of temporary object' has 2 successors of kind 'Goto' in function '$@'. | destructors_for_temps.cpp:54:6:54:15 | void temp_test8(bool) | void temp_test8(bool) |

Просмотреть файл

@ -54,3 +54,7 @@ void temp_test7(bool b) {
void temp_test8(bool b) {
b ? throw ClassWithConstructor('x', ClassWithDestructor2().get_x()) : ClassWithDestructor2();
}
void temp_test8_simple(bool b) {
b ? throw ClassWithDestructor2().get_x() : 'a';
}

Просмотреть файл

@ -1299,6 +1299,40 @@
| destructors_for_temps.cpp:55:75:55:96 | SideEffect | ~m55_76 |
| destructors_for_temps.cpp:55:75:55:96 | StoreValue | r55_40 |
| destructors_for_temps.cpp:55:75:55:96 | Unary | r55_32 |
| destructors_for_temps.cpp:58:6:58:22 | ChiPartial | partial:m58_3 |
| destructors_for_temps.cpp:58:6:58:22 | ChiTotal | total:m58_2 |
| destructors_for_temps.cpp:58:6:58:22 | SideEffect | ~m59_16 |
| destructors_for_temps.cpp:58:29:58:29 | Address | &:r58_5 |
| destructors_for_temps.cpp:59:5:59:5 | Address | &:r59_1 |
| destructors_for_temps.cpp:59:5:59:5 | Condition | r59_2 |
| destructors_for_temps.cpp:59:5:59:5 | Load | m58_6 |
| destructors_for_temps.cpp:59:5:59:50 | Address | &:r59_23 |
| destructors_for_temps.cpp:59:5:59:50 | Address | &:r59_25 |
| destructors_for_temps.cpp:59:5:59:50 | Load | m59_24 |
| destructors_for_temps.cpp:59:9:59:44 | Address | &:r59_4 |
| destructors_for_temps.cpp:59:9:59:44 | Address | &:r59_4 |
| destructors_for_temps.cpp:59:9:59:44 | Load | m59_20 |
| destructors_for_temps.cpp:59:15:59:36 | Address | &:r59_5 |
| destructors_for_temps.cpp:59:15:59:36 | Address | &:r59_5 |
| destructors_for_temps.cpp:59:15:59:36 | Address | &:r59_5 |
| destructors_for_temps.cpp:59:15:59:36 | Address | &:r59_5 |
| destructors_for_temps.cpp:59:15:59:36 | Arg(this) | this:r59_5 |
| destructors_for_temps.cpp:59:15:59:36 | Arg(this) | this:r59_5 |
| destructors_for_temps.cpp:59:15:59:36 | CallTarget | func:r59_7 |
| destructors_for_temps.cpp:59:15:59:36 | ChiPartial | partial:m59_9 |
| destructors_for_temps.cpp:59:15:59:36 | ChiPartial | partial:m59_11 |
| destructors_for_temps.cpp:59:15:59:36 | ChiPartial | partial:m59_18 |
| destructors_for_temps.cpp:59:15:59:36 | ChiTotal | total:m58_4 |
| destructors_for_temps.cpp:59:15:59:36 | ChiTotal | total:m59_6 |
| destructors_for_temps.cpp:59:15:59:36 | ChiTotal | total:m59_12 |
| destructors_for_temps.cpp:59:15:59:36 | SideEffect | m59_12 |
| destructors_for_temps.cpp:59:15:59:36 | SideEffect | ~m58_4 |
| destructors_for_temps.cpp:59:38:59:42 | CallTarget | func:r59_13 |
| destructors_for_temps.cpp:59:38:59:42 | ChiPartial | partial:m59_15 |
| destructors_for_temps.cpp:59:38:59:42 | ChiTotal | total:m59_10 |
| destructors_for_temps.cpp:59:38:59:42 | SideEffect | ~m59_10 |
| destructors_for_temps.cpp:59:38:59:42 | StoreValue | r59_14 |
| destructors_for_temps.cpp:59:48:59:50 | StoreValue | r59_22 |
| file://:0:0:0:0 | Address | &:r0_1 |
| file://:0:0:0:0 | Address | &:r0_1 |
| file://:0:0:0:0 | Address | &:r0_1 |

Просмотреть файл

@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| destructors_for_temps.cpp:59:5:59:50 | Load: ... ? ... : ... | Instruction 'Load: ... ? ... : ...' has no successors in function '$@'. | destructors_for_temps.cpp:58:6:58:22 | void temp_test8_simple(bool) | void temp_test8_simple(bool) |
ambiguousSuccessors
| destructors_for_temps.cpp:51:75:51:96 | IndirectMayWriteSideEffect: reuse of temporary object | Instruction 'IndirectMayWriteSideEffect: reuse of temporary object' has 2 successors of kind 'Goto' in function '$@'. | destructors_for_temps.cpp:49:6:49:15 | void temp_test7(bool) | void temp_test7(bool) |
| destructors_for_temps.cpp:55:75:55:96 | IndirectMayWriteSideEffect: reuse of temporary object | Instruction 'IndirectMayWriteSideEffect: reuse of temporary object' has 2 successors of kind 'Goto' in function '$@'. | destructors_for_temps.cpp:54:6:54:15 | void temp_test8(bool) | void temp_test8(bool) |

Просмотреть файл

@ -1170,12 +1170,12 @@ destructors_for_temps.cpp:
# 51| mu51_57(unknown) = ^CallSideEffect : ~m?
# 51| v51_58(void) = ^IndirectReadSideEffect[-1] : &:r51_42, &:r51_54, ~m?
# 51| mu51_59(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r51_42, &:r51_54
#-----| Goto (back edge) -> Block 3
#-----| Goto (back edge) -> Block 4
#-----| Goto (back edge) -> Block 3
# 51| Block 8
#-----| Goto (back edge) -> Block 3
#-----| Goto (back edge) -> Block 4
#-----| Goto (back edge) -> Block 3
# 54| void temp_test8(bool)
# 54| Block 0
@ -1259,12 +1259,62 @@ destructors_for_temps.cpp:
# 55| mu55_57(unknown) = ^CallSideEffect : ~m?
# 55| v55_58(void) = ^IndirectReadSideEffect[-1] : &:r55_42, &:r55_54, ~m?
# 55| mu55_59(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r55_42, &:r55_54
#-----| Goto (back edge) -> Block 3
#-----| Goto (back edge) -> Block 4
#-----| Goto (back edge) -> Block 3
# 55| Block 8
#-----| Goto (back edge) -> Block 3
#-----| Goto (back edge) -> Block 4
#-----| Goto (back edge) -> Block 3
# 58| void temp_test8_simple(bool)
# 58| Block 0
# 58| v58_1(void) = EnterFunction :
# 58| mu58_2(unknown) = AliasedDefinition :
# 58| mu58_3(unknown) = InitializeNonLocal :
# 58| r58_4(glval<bool>) = VariableAddress[b] :
# 58| mu58_5(bool) = InitializeParameter[b] : &:r58_4
# 59| r59_1(glval<bool>) = VariableAddress[b] :
# 59| r59_2(bool) = Load[b] : &:r59_1, ~m?
# 59| v59_3(void) = ConditionalBranch : r59_2
#-----| False -> Block 4
#-----| True -> Block 3
# 58| Block 1
# 58| v58_6(void) = AliasedUse : ~m?
# 58| v58_7(void) = ExitFunction :
# 58| Block 2
# 58| v58_8(void) = Unwind :
#-----| Goto -> Block 1
# 59| Block 3
# 59| r59_4(glval<char>) = VariableAddress[#throw59:9] :
# 59| r59_5(glval<ClassWithDestructor2>) = VariableAddress[#temp59:15] :
# 59| mu59_6(ClassWithDestructor2) = Uninitialized[#temp59:15] : &:r59_5
# 59| r59_7(glval<unknown>) = FunctionAddress[ClassWithDestructor2] :
# 59| v59_8(void) = Call[ClassWithDestructor2] : func:r59_7, this:r59_5
# 59| mu59_9(unknown) = ^CallSideEffect : ~m?
# 59| mu59_10(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r59_5
# 59| r59_11(glval<unknown>) = FunctionAddress[get_x] :
# 59| r59_12(char) = Call[get_x] : func:r59_11, this:r59_5
# 59| mu59_13(unknown) = ^CallSideEffect : ~m?
# 59| v59_14(void) = ^IndirectReadSideEffect[-1] : &:r59_5, ~m?
# 59| mu59_15(ClassWithDestructor2) = ^IndirectMayWriteSideEffect[-1] : &:r59_5
# 59| mu59_16(char) = Store[#throw59:9] : &:r59_4, r59_12
# 59| v59_17(void) = ThrowValue : &:r59_4, ~m?
#-----| Exception -> Block 2
# 59| Block 4
# 59| r59_18(char) = Constant[97] :
# 59| r59_19(glval<char>) = VariableAddress[#temp59:5] :
# 59| mu59_20(char) = Store[#temp59:5] : &:r59_19, r59_18
# 59| r59_21(glval<char>) = VariableAddress[#temp59:5] :
# 59| r59_22(char) = Load[#temp59:5] : &:r59_21, ~m?
# 60| Block 5
# 60| v60_1(void) = NoOp :
# 58| v58_9(void) = ReturnVoid :
#-----| Goto -> Block 1
ir.c:
# 7| void MyCoordsTest(int)

Просмотреть файл

@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| destructors_for_temps.cpp:59:5:59:50 | Load: ... ? ... : ... | Instruction 'Load: ... ? ... : ...' has no successors in function '$@'. | destructors_for_temps.cpp:58:6:58:22 | void temp_test8_simple(bool) | void temp_test8_simple(bool) |
ambiguousSuccessors
| destructors_for_temps.cpp:51:75:51:96 | IndirectMayWriteSideEffect: reuse of temporary object | Instruction 'IndirectMayWriteSideEffect: reuse of temporary object' has 2 successors of kind 'Goto' in function '$@'. | destructors_for_temps.cpp:49:6:49:15 | void temp_test7(bool) | void temp_test7(bool) |
| destructors_for_temps.cpp:55:75:55:96 | IndirectMayWriteSideEffect: reuse of temporary object | Instruction 'IndirectMayWriteSideEffect: reuse of temporary object' has 2 successors of kind 'Goto' in function '$@'. | destructors_for_temps.cpp:54:6:54:15 | void temp_test8(bool) | void temp_test8(bool) |

Просмотреть файл

@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| destructors_for_temps.cpp:59:5:59:50 | Load: ... ? ... : ... | Instruction 'Load: ... ? ... : ...' has no successors in function '$@'. | destructors_for_temps.cpp:58:6:58:22 | void temp_test8_simple(bool) | void temp_test8_simple(bool) |
ambiguousSuccessors
| destructors_for_temps.cpp:51:75:51:96 | IndirectMayWriteSideEffect: reuse of temporary object | Instruction 'IndirectMayWriteSideEffect: reuse of temporary object' has 2 successors of kind 'Goto' in function '$@'. | destructors_for_temps.cpp:49:6:49:15 | void temp_test7(bool) | void temp_test7(bool) |
| destructors_for_temps.cpp:55:75:55:96 | IndirectMayWriteSideEffect: reuse of temporary object | Instruction 'IndirectMayWriteSideEffect: reuse of temporary object' has 2 successors of kind 'Goto' in function '$@'. | destructors_for_temps.cpp:54:6:54:15 | void temp_test8(bool) | void temp_test8(bool) |