minix/external/bsd/llvm/dist/clang/test/CodeGen/2008-07-31-promotion-of-compound-pointer-arithmetic.c
Lionel Sambuc f4a2713ac8 Importing netbsd clang -- pristine
Change-Id: Ia40e9ffdf29b5dab2f122f673ff6802a58bc690f
2014-07-28 17:05:57 +02:00

31 lines
554 B
C

// RUN: %clang_cc1 -triple i386-unknown-unknown -O1 -emit-llvm -o - %s | FileCheck %s
// CHECK-LABEL: define i32 @f0
// CHECK: ret i32 1
// CHECK-LABEL: define i32 @f1
// CHECK: ret i32 1
// CHECK-LABEL: define i32 @f2
// CHECK: ret i32 1
// <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;
}