Daniel Dunbar | 0d7b091 | 2009-02-03 21:54:49 +0000 | [diff] [blame] | 1 | // RUN: clang -triple i386-unknown-unknown -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis | grep "ret i32 1" | count 3 |
Daniel Dunbar | 8c6f57c | 2008-08-06 02:00:38 +0000 | [diff] [blame] | 2 | // <rdr://6115726> |
| 3 | |
| 4 | int f0() { |
| 5 | int x; |
| 6 | unsigned short n = 1; |
| 7 | int *a = &x; |
| 8 | int *b = &x; |
| 9 | a = a - n; |
| 10 | b -= n; |
| 11 | return a == b; |
| 12 | } |
| 13 | |
| 14 | int f1(int *a) { |
Sebastian Redl | f0d960a | 2008-11-12 00:18:32 +0000 | [diff] [blame] | 15 | long b = a - (int*) 1; |
Daniel Dunbar | 8c6f57c | 2008-08-06 02:00:38 +0000 | [diff] [blame] | 16 | a -= (int*) 1; |
Sebastian Redl | f0d960a | 2008-11-12 00:18:32 +0000 | [diff] [blame] | 17 | return b == (long) a; |
Daniel Dunbar | 8c6f57c | 2008-08-06 02:00:38 +0000 | [diff] [blame] | 18 | } |
| 19 | |
Sebastian Redl | f0d960a | 2008-11-12 00:18:32 +0000 | [diff] [blame] | 20 | int f2(long n) { |
Daniel Dunbar | 8c6f57c | 2008-08-06 02:00:38 +0000 | [diff] [blame] | 21 | int *b = n + (int*) 1; |
| 22 | n += (int*) 1; |
| 23 | return b == (int*) n; |
| 24 | } |
| 25 | |