Since we are using a gep_type_iterator, we apparently must get the type
authorBrian Gaeke <gaeke@uiuc.edu>
Fri, 12 Dec 2003 05:13:05 +0000 (05:13 +0000)
committerBrian Gaeke <gaeke@uiuc.edu>
Fri, 12 Dec 2003 05:13:05 +0000 (05:13 +0000)
index by using I.getOperand() here. This was failing an assertion on
basically every struct access.

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

lib/ExecutionEngine/Interpreter/Execution.cpp

index 732a485d783111c5dbe44e41257f1050a1086694..abade5f857a0cc3a2b5a2446477b1c6b047ea11e 100644 (file)
@@ -706,8 +706,7 @@ GenericValue Interpreter::executeGEPOperation(Value *Ptr, gep_type_iterator I,
     if (const StructType *STy = dyn_cast<StructType>(*I)) {
       const StructLayout *SLO = TD.getStructLayout(STy);
       
-      // Indices must be ubyte constants...
-      const ConstantUInt *CPU = cast<ConstantUInt>(*I);
+      const ConstantUInt *CPU = cast<ConstantUInt>(I.getOperand());
       unsigned Index = CPU->getValue();
       
       Total += SLO->MemberOffsets[Index];