summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Noblesmith <nobled@dreamwidth.org>2011-12-31 13:58:58 +0000
committerDylan Noblesmith <nobled@dreamwidth.org>2011-12-31 13:58:58 +0000
commit1c65a21ec454e989596c22dc7c36450ae723ed24 (patch)
tree33a759d3647f4b07829203d846dd7f3fad1e8a4a
parent1154e75c7c2b9c41128b82396e3769b14481e79e (diff)
downloadbcm5719-llvm-1c65a21ec454e989596c22dc7c36450ae723ed24.tar.gz
bcm5719-llvm-1c65a21ec454e989596c22dc7c36450ae723ed24.zip
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
-rw-r--r--llvm/lib/VMCore/Type.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Type.cpp b/llvm/lib/VMCore/Type.cpp
index f4fad667a13..d19dc06caa1 100644
--- a/llvm/lib/VMCore/Type.cpp
+++ b/llvm/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) {
OpenPOWER on IntegriCloud