diff options
| author | Ted Kremenek <kremenek@apple.com> | 2009-02-25 22:32:02 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2009-02-25 22:32:02 +0000 |
| commit | dc3f50fbd95317f96d9ce0084b19bd331e3f8560 (patch) | |
| tree | 92141477d7dc81bcfa38662278451f2e5cb1fb32 /clang/test/Analysis/misc-ps-eager-assume.m | |
| parent | 1e249f86413143a681ead49d14bacb4f0f83a4cb (diff) | |
| download | bcm5719-llvm-dc3f50fbd95317f96d9ce0084b19bd331e3f8560.tar.gz bcm5719-llvm-dc3f50fbd95317f96d9ce0084b19bd331e3f8560.zip | |
Add experimental logic in GRExprEngine::EvalEagerlyAssume() to handle
expressions of the form: 'short x = (y != 10);' While we handle 'int x = (y !=
10)' lazily, the cast to another integer type currently loses the symbolic
constraint. Eager evaluation of the constraint causes the paths to bifurcate and
eagerly evaluate 'y != 10' to a constant of 1 or 0. This should address
<rdar://problem/6619921> until we have a better (more lazy approach) for
handling promotions/truncations of symbolic integer values.
llvm-svn: 65480
Diffstat (limited to 'clang/test/Analysis/misc-ps-eager-assume.m')
| -rw-r--r-- | clang/test/Analysis/misc-ps-eager-assume.m | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Analysis/misc-ps-eager-assume.m b/clang/test/Analysis/misc-ps-eager-assume.m new file mode 100644 index 00000000000..48d5b8f9d22 --- /dev/null +++ b/clang/test/Analysis/misc-ps-eager-assume.m @@ -0,0 +1,14 @@ +// RUN: clang -analyze -checker-cfref --analyzer-store=region -analyzer-constraints=range --verify -fblocks %s -analyzer-eagerly-assume + +void handle_assign_of_condition(int x) { + // The cast to 'short' causes us to lose symbolic constraint. + short y = (x != 0); + char *p = 0; + if (y) { + // This should be infeasible. + if (!(x != 0)) { + *p = 1; // no-warning + } + } +} + |

