diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-09-04 19:34:58 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-09-04 19:34:58 +0000 |
commit | 7523d1a847b661d0a8cc71f8aa051c873278445a (patch) | |
tree | f712e604a31e509e7b129ecf169d42fd67340f64 /clang/test/Analysis/idempotent-operations.c | |
parent | 7a204359dc0f577770be16c44216fc9e19675f3f (diff) | |
download | bcm5719-llvm-7523d1a847b661d0a8cc71f8aa051c873278445a.tar.gz bcm5719-llvm-7523d1a847b661d0a8cc71f8aa051c873278445a.zip |
[analyzer] Don't use makeIntVal to create a floating-point value.
SimpleSValBuilder processes a couple trivial identities, including 'x - x'
and 'x ^ x' (both 0). However, the former could appear with arguments of
floating-point type, and we weren't checking for that. This started
triggering an assert with r163069, which checks that a constant value is
actually going to be used as an integer or pointer.
llvm-svn: 163159
Diffstat (limited to 'clang/test/Analysis/idempotent-operations.c')
-rw-r--r-- | clang/test/Analysis/idempotent-operations.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Analysis/idempotent-operations.c b/clang/test/Analysis/idempotent-operations.c index 9281f279980..793e7cd324b 100644 --- a/clang/test/Analysis/idempotent-operations.c +++ b/clang/test/Analysis/idempotent-operations.c @@ -234,3 +234,11 @@ void rdar8601243() { (void) start; } + +float testFloatCast(int i) { + float f = i; + + // Don't crash when trying to create a "zero" float. + return f - f; +} + |