diff options
author | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
commit | f27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch) | |
tree | ce7d964cbb5e39695b71481698f10cb099c23d4a /test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c | |
download | FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz |
Import Clang, at r72732.
Diffstat (limited to 'test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c')
-rw-r--r-- | test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c b/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c new file mode 100644 index 0000000..0ce4ba6 --- /dev/null +++ b/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c @@ -0,0 +1,25 @@ +// RUN: clang-cc -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis | grep "ret i32 1" | count 3 +// <rdr://6115726> + +int f0() { + int x; + unsigned short n = 1; + int *a = &x; + int *b = &x; + a = a - n; + b -= n; + return a == b; +} + +int f1(int *a) { + long b = a - (int*) 1; + a -= (int*) 1; + return b == (long) a; +} + +int f2(long n) { + int *b = n + (int*) 1; + n += (int*) 1; + return b == (int*) n; +} + |