[llvm-commits] [llvm] r147390 - /llvm/trunk/lib/VMCore/Type.cpp

Dylan Noblesmith nobled at dreamwidth.org
Sat Dec 31 05:58:59 PST 2011


Author: nobled
Date: Sat Dec 31 07:58:58 2011
New Revision: 147390

URL: http://llvm.org/viewvc/llvm-project?rev=147390&view=rev
Log:
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.


Modified:
    llvm/trunk/lib/VMCore/Type.cpp

Modified: llvm/trunk/lib/VMCore/Type.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Type.cpp?rev=147390&r1=147389&r2=147390&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Type.cpp (original)
+++ llvm/trunk/lib/VMCore/Type.cpp Sat Dec 31 07:58:58 2011
@@ -707,7 +707,12 @@
 
 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) {





More information about the llvm-commits mailing list