[llvm-commits] CVS: llvm/lib/VMCore/Verifier.cpp iMemory.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Jan 14 16:20:01 PST 2003
Changes in directory llvm/lib/VMCore:
Verifier.cpp updated: 1.43 -> 1.44
iMemory.cpp updated: 1.28 -> 1.29
---
Log message:
Fix bug Regression/Verifier/2002-11-05-GetelementptrPointers.ll
---
Diffs of the changes:
Index: llvm/lib/VMCore/Verifier.cpp
diff -u llvm/lib/VMCore/Verifier.cpp:1.43 llvm/lib/VMCore/Verifier.cpp:1.44
--- llvm/lib/VMCore/Verifier.cpp:1.43 Thu Nov 21 10:54:22 2002
+++ llvm/lib/VMCore/Verifier.cpp Tue Jan 14 16:19:44 2003
@@ -23,7 +23,6 @@
// * All Instructions must be embeded into a basic block
// . Function's cannot take a void typed parameter
// * Verify that a function's argument list agrees with it's declared type.
-// . Verify that arrays and structures have fixed elements: No unsized arrays.
// * It is illegal to specify a name for a void value.
// * It is illegal to have a internal global value with no intitalizer
// * It is illegal to have a ret instruction that returns a value that does not
Index: llvm/lib/VMCore/iMemory.cpp
diff -u llvm/lib/VMCore/iMemory.cpp:1.28 llvm/lib/VMCore/iMemory.cpp:1.29
--- llvm/lib/VMCore/iMemory.cpp:1.28 Fri Sep 13 17:28:30 2002
+++ llvm/lib/VMCore/iMemory.cpp Tue Jan 14 16:19:44 2003
@@ -116,16 +116,18 @@
// Handle the special case of the empty set index set...
if (Idx.empty()) return cast<PointerType>(Ptr)->getElementType();
- unsigned CurIDX = 0;
+ unsigned CurIdx = 0;
while (const CompositeType *CT = dyn_cast<CompositeType>(Ptr)) {
- if (Idx.size() == CurIDX) {
+ if (Idx.size() == CurIdx) {
if (AllowCompositeLeaf || CT->isFirstClassType()) return Ptr;
return 0; // Can't load a whole structure or array!?!?
}
- Value *Index = Idx[CurIDX++];
+ Value *Index = Idx[CurIdx++];
+ if (isa<PointerType>(CT) && CurIdx != 1)
+ return 0; // Can only index into pointer types at the first index!
if (!CT->indexValid(Index)) return 0;
Ptr = CT->getTypeAtIndex(Index);
}
- return CurIDX == Idx.size() ? Ptr : 0;
+ return CurIdx == Idx.size() ? Ptr : 0;
}
More information about the llvm-commits
mailing list