summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Analysis/ValueTrackingTest.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-14 17:59:19 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-14 17:59:19 +0000
commit8580cd4e1a6edc7e0b9663287b5819456d491325 (patch)
tree94697273392da06ece7c0e06e2462eaedd2868d3 /llvm/unittests/Analysis/ValueTrackingTest.cpp
parentc22c7b14593ea611088d5f3cd6cf2f8b88202d1d (diff)
downloadbcm5719-llvm-8580cd4e1a6edc7e0b9663287b5819456d491325.tar.gz
bcm5719-llvm-8580cd4e1a6edc7e0b9663287b5819456d491325.zip
[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 llvm-svn: 300354
Diffstat (limited to 'llvm/unittests/Analysis/ValueTrackingTest.cpp')
-rw-r--r--llvm/unittests/Analysis/ValueTrackingTest.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/unittests/Analysis/ValueTrackingTest.cpp b/llvm/unittests/Analysis/ValueTrackingTest.cpp
index a1d3695e969..3c8ecfbe1ee 100644
--- a/llvm/unittests/Analysis/ValueTrackingTest.cpp
+++ b/llvm/unittests/Analysis/ValueTrackingTest.cpp
@@ -219,7 +219,7 @@ TEST(ValueTracking, GuaranteedToTransferExecutionToSuccessor) {
assert(F && "Bad assembly?");
auto &BB = F->getEntryBlock();
- ArrayRef<bool> ExpectedAnswers = {
+ bool ExpectedAnswers[] = {
true, // call void @nounwind_readonly(i32* %p)
true, // call void @nounwind_argmemonly(i32* %p)
false, // call void @throws_but_readonly(i32* %p)
OpenPOWER on IntegriCloud