Daniel Dunbar | d286f05 | 2009-07-19 06:58:07 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -emit-llvm -o %t %s && |
| 2 | // RUN: grep '@unreachable' %t | count 0 |
| 3 | |
Daniel Dunbar | cd5e60e | 2009-07-19 08:23:12 +0000 | [diff] [blame] | 4 | extern void abort() __attribute__((noreturn)); |
Daniel Dunbar | d286f05 | 2009-07-19 06:58:07 +0000 | [diff] [blame] | 5 | extern int unreachable(); |
| 6 | |
| 7 | int f0() { |
| 8 | return 0; |
| 9 | unreachable(); |
| 10 | } |
| 11 | |
| 12 | int f1(int i) { |
| 13 | goto L0; |
| 14 | int a = unreachable(); |
| 15 | L0: |
| 16 | return 0; |
| 17 | } |
| 18 | |
| 19 | int f2(int i) { |
| 20 | goto L0; |
| 21 | unreachable(); |
| 22 | int a; |
| 23 | unreachable(); |
| 24 | L0: |
| 25 | a = i + 1; |
| 26 | return a; |
| 27 | } |
Daniel Dunbar | cd5e60e | 2009-07-19 08:23:12 +0000 | [diff] [blame] | 28 | |
| 29 | int f3(int i) { |
| 30 | if (i) { |
| 31 | return 0; |
| 32 | } else { |
| 33 | abort(); |
| 34 | } |
| 35 | unreachable(); |
| 36 | return 3; |
| 37 | } |