From 06b6c587e8c51c76b85f64c3d47176bc25aafd0b Mon Sep 17 00:00:00 2001 From: Dylan Noblesmith Date: Sat, 31 Dec 2011 13:58:58 +0000 Subject: [PATCH] VMCore: add assert for miscompile See PR11652. Trying to add this assert to setSubclassData() itself actually prevented the miscompile entirely, so it has to be here. This makes the source of the bug more obvious than the other asserts triggering later on did. llvm-svn: 147390 --- lib/VMCore/Type.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/VMCore/Type.cpp b/lib/VMCore/Type.cpp index f4fad667a13..d19dc06caa1 100644 --- a/lib/VMCore/Type.cpp +++ b/lib/VMCore/Type.cpp @@ -707,7 +707,12 @@ PointerType *PointerType::get(Type *EltTy, unsigned AddressSpace) { PointerType::PointerType(Type *E, unsigned AddrSpace) : SequentialType(PointerTyID, E) { +#ifndef NDEBUG + const unsigned oldNCT = NumContainedTys; +#endif setSubclassData(AddrSpace); + // Check for miscompile. PR11652. + assert(oldNCT == NumContainedTys && "bitfield written out of bounds?"); } PointerType *Type::getPointerTo(unsigned addrs) {