]> granicus.if.org Git - llvm/commitdiff
[TTI] Initialize a value to trigger a crash deterministically.
authorDavide Italiano <davide@freebsd.org>
Fri, 1 Sep 2017 19:36:34 +0000 (19:36 +0000)
committerDavide Italiano <davide@freebsd.org>
Fri, 1 Sep 2017 19:36:34 +0000 (19:36 +0000)
We expect the pointer to be initialized by the above loop, but
if that's not executed, the contents are garbage.
A fix for the crash will be committed immediately after.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@312353 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Analysis/TargetTransformInfoImpl.h

index 24989941ac835659db9d25cb487665f750b29a9d..c191b86b494688f3def298b82bfb78bd8b71b326 100644 (file)
@@ -674,7 +674,7 @@ public:
     int64_t Scale = 0;
 
     auto GTI = gep_type_begin(PointeeType, Operands);
-    Type *TargetType;
+    Type *TargetType = nullptr;
     for (auto I = Operands.begin(); I != Operands.end(); ++I, ++GTI) {
       TargetType = GTI.getIndexedType();
       // We assume that the cost of Scalar GEP with constant index and the