2013-01-22 09:51:59 +08:00
|
|
|
// RUN: %clang_cc1 -triple i386-unknown-unknown -O1 -emit-llvm -o - %s | FileCheck %s
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define i32 @f0
|
2013-01-22 09:51:59 +08:00
|
|
|
// CHECK: ret i32 1
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define i32 @f1
|
2013-01-22 09:51:59 +08:00
|
|
|
// CHECK: ret i32 1
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define i32 @f2
|
2013-01-22 09:51:59 +08:00
|
|
|
// CHECK: ret i32 1
|
2008-08-06 10:00:38 +08:00
|
|
|
// <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) {
|
2008-11-12 08:18:32 +08:00
|
|
|
long b = a - (int*) 1;
|
2008-08-06 10:00:38 +08:00
|
|
|
a -= (int*) 1;
|
2008-11-12 08:18:32 +08:00
|
|
|
return b == (long) a;
|
2008-08-06 10:00:38 +08:00
|
|
|
}
|
|
|
|
|
2008-11-12 08:18:32 +08:00
|
|
|
int f2(long n) {
|
2008-08-06 10:00:38 +08:00
|
|
|
int *b = n + (int*) 1;
|
|
|
|
n += (int*) 1;
|
|
|
|
return b == (int*) n;
|
|
|
|
}
|
|
|
|
|