From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- ...7-31-promotion-of-compound-pointer-arithmetic.c | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 clang/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c (limited to 'clang/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c') diff --git a/clang/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c b/clang/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c new file mode 100644 index 0000000..de06263 --- /dev/null +++ b/clang/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c @@ -0,0 +1,25 @@ +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis | grep "ret i32 1" | count 3 +// + +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; +} + -- cgit v1.2.3