Daniel Dunbar | 16f2357 | 2008-07-25 01:11:38 +0000 | [diff] [blame] | 1 | // RUN: clang --emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis > %t && |
2 | // RUN: grep "ret i32 10" %t | ||||
3 | |||||
4 | // Ensure that this doesn't compile to infinite loop in g() due to | ||||
5 | // miscompilation of fallthrough from default to a (tested) case | ||||
6 | // range. | ||||
7 | |||||
8 | static int f0(unsigned x) { | ||||
9 | switch(x) { | ||||
10 | default: | ||||
11 | x += 1; | ||||
12 | case 10 ... 0xFFFFFFFF: | ||||
13 | return 0; | ||||
14 | } | ||||
15 | } | ||||
16 | |||||
17 | int g() { | ||||
18 | f0(1); | ||||
19 | return 10; | ||||
20 | } |