From e41458c37923c77fdae39676b3b4bce9f6c80def Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Fri, 25 May 2012 16:02:16 +0000 Subject: [PATCH] [analyzer] Don't crash on LValBitCast git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@157478 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/StaticAnalyzer/Core/ExprEngineC.cpp | 4 ++-- test/Analysis/cxx11-crashes.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/lib/StaticAnalyzer/Core/ExprEngineC.cpp index 2e3e9f51e7..6707860009 100644 --- a/lib/StaticAnalyzer/Core/ExprEngineC.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngineC.cpp @@ -279,7 +279,6 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex, case CK_Dependent: case CK_ArrayToPointerDecay: case CK_BitCast: - case CK_LValueBitCast: case CK_IntegralCast: case CK_NullToPointer: case CK_IntegralToPointer: @@ -378,7 +377,8 @@ void ExprEngine::VisitCast(const CastExpr *CastE, const Expr *Ex, case CK_UserDefinedConversion: case CK_ConstructorConversion: case CK_VectorSplat: - case CK_MemberPointerToBoolean: { + case CK_MemberPointerToBoolean: + case CK_LValueBitCast: { // Recover some path-sensitivty by conjuring a new value. QualType resultType = CastE->getType(); if (CastE->isGLValue()) diff --git a/test/Analysis/cxx11-crashes.cpp b/test/Analysis/cxx11-crashes.cpp index 8c68734da4..16bfc89100 100644 --- a/test/Analysis/cxx11-crashes.cpp +++ b/test/Analysis/cxx11-crashes.cpp @@ -57,3 +57,10 @@ void testRadar11487525_1(){ bool s[25]; addressof(s); } + +// radar://11487525 Don't crash on CK_LValueBitCast. +bool begin(double *it) { + typedef bool type[25]; + bool *a = reinterpret_cast(*( reinterpret_cast( it ))); + return *a; +} -- 2.50.1