aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-07 22:19:19 +0000
committerChris Lattner <sabre@nondot.org>2003-10-07 22:19:19 +0000
commit9eacf8aac8fa19ec5f3e849747af860b023e4dc4 (patch)
tree03ed96bd576a5d96a6fb3e7e5b4b39a93bbc03cd
parentfcc54b3ede1c4234fc1a0ccb70689288c2e33f13 (diff)
downloadexternal_llvm-9eacf8aac8fa19ec5f3e849747af860b023e4dc4.zip
external_llvm-9eacf8aac8fa19ec5f3e849747af860b023e4dc4.tar.gz
external_llvm-9eacf8aac8fa19ec5f3e849747af860b023e4dc4.tar.bz2
Add a sanity check for constant expression casts
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8951 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/VMCore/Constants.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index 3e481fd..4e1d905 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -897,6 +897,8 @@ struct ConvertConstantType<ConstantExpr, Type> {
static ValueMap<ExprMapKeyType, Type, ConstantExpr> ExprConstants;
Constant *ConstantExpr::getCast(Constant *C, const Type *Ty) {
+ assert(Ty->isFirstClassType() && "Cannot cast to an aggregate type!");
+
if (Constant *FC = ConstantFoldCastInstruction(C, Ty))
return FC; // Fold a few common cases...