mirror of
https://github.com/RPCSX/llvm.git
synced 2024-11-24 04:09:45 +00:00
[ValueTracking] Avoid undefined behavior in unittest by not making a named ArrayRef from a std::initializer_list
One of the ValueTracking unittests creates a named ArrayRef initialized by a std::initializer_list. The underlying array for an std::initializer_list is only guaranteed to have a lifetime as long as the initializer_list object itself. So this can leave the ArrayRef pointing at an array that no long exists. This fixes this to just create an explicit array instead of an ArrayRef. Differential Revision: https://reviews.llvm.org/D32089 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300354 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c1656ad227
commit
b4e05013d0
@ -219,7 +219,7 @@ TEST(ValueTracking, GuaranteedToTransferExecutionToSuccessor) {
|
|||||||
assert(F && "Bad assembly?");
|
assert(F && "Bad assembly?");
|
||||||
|
|
||||||
auto &BB = F->getEntryBlock();
|
auto &BB = F->getEntryBlock();
|
||||||
ArrayRef<bool> ExpectedAnswers = {
|
bool ExpectedAnswers[] = {
|
||||||
true, // call void @nounwind_readonly(i32* %p)
|
true, // call void @nounwind_readonly(i32* %p)
|
||||||
true, // call void @nounwind_argmemonly(i32* %p)
|
true, // call void @nounwind_argmemonly(i32* %p)
|
||||||
false, // call void @throws_but_readonly(i32* %p)
|
false, // call void @throws_but_readonly(i32* %p)
|
||||||
|
Loading…
Reference in New Issue
Block a user