diff options
author | Cristian Cadar <cristic@cs.stanford.edu> | 2009-06-04 06:51:12 +0000 |
---|---|---|
committer | Cristian Cadar <cristic@cs.stanford.edu> | 2009-06-04 06:51:12 +0000 |
commit | e3bca69757a80b46d743195944fed6481dec7e4f (patch) | |
tree | 5e22dc79b1117d328cc8cd356687ceb180d2d5dc /lib/Expr/Parser.cpp | |
parent | e8d9177a1533411eb53593c7a16cfa6c188952c9 (diff) | |
download | klee-e3bca69757a80b46d743195944fed6481dec7e4f.tar.gz |
Fixed a bug in Kleaver's parser: APInt does not allow "truncation" to
the same width. Added a test case that was previously triggering an assert violation. git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72850 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Expr/Parser.cpp')
-rw-r--r-- | lib/Expr/Parser.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Expr/Parser.cpp b/lib/Expr/Parser.cpp index 9e1849ae..3bbe3334 100644 --- a/lib/Expr/Parser.cpp +++ b/lib/Expr/Parser.cpp @@ -1224,7 +1224,10 @@ ExprResult ParserImpl::ParseNumberToken(Expr::Width Type, const Token &Tok) { if (HasMinus) Val = -Val; - return ExprResult(ConstantExpr::alloc(Val.trunc(Type).getZExtValue(), Type)); + if (Type < Val.getBitWidth()) + Val = Val.trunc(Type); + + return ExprResult(ConstantExpr::alloc(Val.getZExtValue(), Type)); } /// ParseTypeSpecifier - Parse a type specifier. |