diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-06-19 17:55:38 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-06-19 17:55:38 +0000 |
commit | b8e26e63d9dcc09351d75677721c6c9ff7045b54 (patch) | |
tree | d2d9468c3444141a27caa5de46de3de80646e0a3 /test/Analysis/complex.c | |
parent | e8eaecd0690d22eff47f7c1a32596bd5e70849b9 (diff) |
Introduce initial transfer function support for __imag__ and __real__. We don't
have complex RValues yet, so this logic is only fully implemented when __imag__
and __real__ are used on non-complex types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52501 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/complex.c')
-rw-r--r-- | test/Analysis/complex.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Analysis/complex.c b/test/Analysis/complex.c new file mode 100644 index 0000000000..7561293171 --- /dev/null +++ b/test/Analysis/complex.c @@ -0,0 +1,17 @@ +// RUN: clang -checker-simple -verify %s + +#include <stdlib.h> + +int f1(int * p) { + + // This branch should be infeasible + // because __imag__ p is 0. + if (!p && __imag__ (intptr_t) p) + *p = 1; // no-warning + + // If p != 0 then this branch is feasible; otherwise it is not. + if (__real__ (intptr_t) p) + *p = 1; // no-warning + + *p = 2; // expected-warning{{Dereference of null pointer}} +} |