From cb07788e20f63ee61862af1c5ee711d9f4c5bf0e Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Sat, 17 Jul 2010 01:28:55 +0000 Subject: [PATCH] Fix ' __imag passed non-complex should not crash' by removing a bogus assertion. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108602 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Checker/GRExprEngine.cpp | 3 +-- test/Analysis/misc-ps.m | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/Checker/GRExprEngine.cpp b/lib/Checker/GRExprEngine.cpp index 1424820f3b..26b5801068 100644 --- a/lib/Checker/GRExprEngine.cpp +++ b/lib/Checker/GRExprEngine.cpp @@ -2835,8 +2835,7 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, ExplodedNode* Pred, continue; } - // For all other types, UnaryOperator::Float returns 0. - assert (Ex->getType()->isIntegerType()); + // For all other types, UnaryOperator::Imag returns 0. const GRState* state = GetState(*I); SVal X = ValMgr.makeZeroVal(Ex->getType()); MakeNode(Dst, U, *I, state->BindExpr(U, X)); diff --git a/test/Analysis/misc-ps.m b/test/Analysis/misc-ps.m index 7de1305049..c2099b04a9 100644 --- a/test/Analysis/misc-ps.m +++ b/test/Analysis/misc-ps.m @@ -1020,3 +1020,9 @@ void pr7475_warn() { *someStatic = 0; // expected-warning{{null pointer}} } +// - __imag passed non-complex should not crash +float f0(_Complex float x) { + float l0 = __real x; + return __real l0 + __imag l0; +} + -- 2.50.1