[analyzer] GNU __null is a pointer-sized integer, not a pointer. Fixes PR10372.

llvm-svn: 135294
This commit is contained in:
Jordy Rose 2011-07-15 20:29:02 +00:00
parent 063fd270ed
commit b72bd53f7d
2 changed files with 12 additions and 1 deletions

View File

@ -510,7 +510,10 @@ void ExprEngine::Visit(const Stmt* S, ExplodedNode* Pred,
break; break;
case Stmt::GNUNullExprClass: { case Stmt::GNUNullExprClass: {
MakeNode(Dst, S, Pred, GetState(Pred)->BindExpr(S, svalBuilder.makeNull())); // GNU __null is a pointer-width integer, not an actual pointer.
const GRState *state = GetState(Pred);
state = state->BindExpr(S, svalBuilder.makeIntValWithPtrWidth(0, false));
MakeNode(Dst, S, Pred, state);
break; break;
} }

View File

@ -39,3 +39,11 @@ void foo4(void) {
*np = 0; // no-warning *np = 0; // no-warning
} }
int pr10372(void *& x) {
// GNU null is a pointer-sized integer, not a pointer.
x = __null;
// This used to crash.
return __null;
}