C++: Add testcase with invalid IR from constructing a 'RoutineType'.

This commit is contained in:
Mathias Vorreiter Pedersen
2024-02-27 17:40:49 +00:00
parent 0335a4f4ce
commit 892f97cd7a
10 changed files with 65 additions and 0 deletions

View File

@@ -18076,6 +18076,25 @@ ir.cpp:
# 2317| getQualifier(): [VariableAccess] s
# 2317| Type = [Struct] String
# 2317| ValueCategory = lvalue
# 2320| [CopyAssignmentOperator] return_routine_type::HasVoidToIntFunc& return_routine_type::HasVoidToIntFunc::operator=(return_routine_type::HasVoidToIntFunc const&)
# 2320| <params>:
#-----| getParameter(0): [Parameter] (unnamed parameter 0)
#-----| Type = [LValueReferenceType] const HasVoidToIntFunc &
# 2320| [MoveAssignmentOperator] return_routine_type::HasVoidToIntFunc& return_routine_type::HasVoidToIntFunc::operator=(return_routine_type::HasVoidToIntFunc&&)
# 2320| <params>:
#-----| getParameter(0): [Parameter] (unnamed parameter 0)
#-----| Type = [RValueReferenceType] HasVoidToIntFunc &&
# 2322| [MemberFunction] void return_routine_type::HasVoidToIntFunc::VoidToInt(int)
# 2322| <params>:
# 2322| getParameter(0): [Parameter] (unnamed parameter 0)
# 2322| Type = [IntType] int
# 2327| [TopLevelFunction] return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc()
# 2327| <params>:
# 2328| getEntryPoint(): [BlockStmt] { ... }
# 2329| getStmt(0): [ReturnStmt] return ...
# 2329| getExpr(): [FunctionAccess] VoidToInt
# 2329| Type = [RoutineType] ..()(..)
# 2329| ValueCategory = prvalue
perf-regression.cpp:
# 4| [CopyAssignmentOperator] Big& Big::operator=(Big const&)
# 4| <params>:

View File

@@ -14579,6 +14579,14 @@ ir.cpp:
# 2314| v2314_6(void) = AliasedUse : ~m2317_5
# 2314| v2314_7(void) = ExitFunction :
# 2327| return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc()
# 2327| Block 0
# 2327| v2327_1(void) = EnterFunction :
# 2327| m2327_2(unknown) = AliasedDefinition :
# 2327| m2327_3(unknown) = InitializeNonLocal :
# 2327| m2327_4(unknown) = Chi : total:m2327_2, partial:m2327_3
# 2329| r2329_1(glval<..:: *>) = VariableAddress[#return] :
perf-regression.cpp:
# 6| void Big::Big()
# 6| Block 0

View File

@@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| ir.cpp:2329:9:2329:44 | VariableAddress: return ... | Instruction 'VariableAddress: return ...' has no successors in function '$@'. | ir.cpp:2327:32:2327:47 | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| ir.cpp:2329:9:2329:44 | VariableAddress: return ... | Instruction 'VariableAddress: return ...' has no successors in function '$@'. | ir.cpp:2327:32:2327:47 | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -2316,4 +2316,19 @@ void VoidReturnDestructors() {
return VoidFunc();
}
namespace return_routine_type {
struct HasVoidToIntFunc
{
void VoidToInt(int);
};
typedef void (HasVoidToIntFunc::*VoidToIntMemberFunc)(int);
static VoidToIntMemberFunc GetVoidToIntFunc()
{
return &HasVoidToIntFunc::VoidToInt;
}
}
// semmle-extractor-options: -std=c++20 --clang

View File

@@ -12029,6 +12029,8 @@
| ir.cpp:2317:1:2317:1 | ChiTotal | total:m2316_4 |
| ir.cpp:2317:1:2317:1 | SideEffect | m2315_8 |
| ir.cpp:2317:1:2317:1 | SideEffect | ~m2316_4 |
| ir.cpp:2327:32:2327:47 | ChiPartial | partial:m2327_3 |
| ir.cpp:2327:32:2327:47 | ChiTotal | total:m2327_2 |
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
| perf-regression.cpp:6:3:6:5 | Address | &:r6_5 |
| perf-regression.cpp:6:3:6:5 | Address | &:r6_7 |

View File

@@ -1,4 +1,5 @@
missingOperand
| ir.cpp:2329:16:2329:43 | Store: VoidToInt | Instruction 'Store' is missing an expected operand with tag 'StoreValue' in function '$@'. | ir.cpp:2327:32:2327:47 | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() |
unexpectedOperand
duplicateOperand
missingPhiOperand
@@ -6,6 +7,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| ir.cpp:2329:9:2329:44 | VariableAddress: return ... | Instruction 'VariableAddress: return ...' has no successors in function '$@'. | ir.cpp:2327:32:2327:47 | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction
@@ -21,6 +23,7 @@ lostReachability
backEdgeCountMismatch
useNotDominatedByDefinition
| ir.cpp:1488:8:1488:8 | Unary | Operand 'Unary' is not dominated by its definition in function '$@'. | ir.cpp:1488:8:1488:8 | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() | void StructuredBindingDataMemberStruct::StructuredBindingDataMemberStruct() |
| ir.cpp:2329:9:2329:44 | Address | Operand 'Address' is not dominated by its definition in function '$@'. | ir.cpp:2327:32:2327:47 | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() |
| try_except.c:13:13:13:13 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.c:6:6:6:6 | void f() | void f() |
| try_except.c:13:13:13:13 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.c:6:6:6:6 | void f() | void f() |
| try_except.c:39:15:39:15 | Left | Operand 'Left' is not dominated by its definition in function '$@'. | try_except.c:32:6:32:6 | void h(int) | void h(int) |

View File

@@ -13510,6 +13510,20 @@ ir.cpp:
# 2314| v2314_5(void) = AliasedUse : ~m?
# 2314| v2314_6(void) = ExitFunction :
# 2327| return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc()
# 2327| Block 0
# 2327| v2327_1(void) = EnterFunction :
# 2327| mu2327_2(unknown) = AliasedDefinition :
# 2327| mu2327_3(unknown) = InitializeNonLocal :
# 2329| r2329_1(glval<..:: *>) = VariableAddress[#return] :
# 2329| Block 1
# 2329| mu2329_2(..:: *) = Store[#return] : &:r2329_1
# 2327| r2327_4(glval<..:: *>) = VariableAddress[#return] :
# 2327| v2327_5(void) = ReturnValue : &:r2327_4, ~m?
# 2327| v2327_6(void) = AliasedUse : ~m?
# 2327| v2327_7(void) = ExitFunction :
perf-regression.cpp:
# 6| void Big::Big()
# 6| Block 0

View File

@@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| ir.cpp:2329:9:2329:44 | VariableAddress: return ... | Instruction 'VariableAddress: return ...' has no successors in function '$@'. | ir.cpp:2327:32:2327:47 | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction

View File

@@ -6,6 +6,7 @@ missingOperandType
duplicateChiOperand
sideEffectWithoutPrimary
instructionWithoutSuccessor
| ir.cpp:2329:9:2329:44 | VariableAddress: return ... | Instruction 'VariableAddress: return ...' has no successors in function '$@'. | ir.cpp:2327:32:2327:47 | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() | return_routine_type::VoidToIntMemberFunc return_routine_type::GetVoidToIntFunc() |
ambiguousSuccessors
unexplainedLoop
unnecessaryPhiInstruction