]>
Commit | Line | Data |
---|---|---|
064997fb | 1 | // compile-flags: -C opt-level=0 |
6a06907d XL |
2 | |
3 | #![crate_type = "lib"] | |
4 | ||
5 | #[repr(C)] | |
6 | pub enum E { | |
7 | A, | |
8 | } | |
9 | ||
10 | // CHECK-LABEL: @index | |
11 | #[no_mangle] | |
064997fb FG |
12 | pub fn index(x: &[u32; 3], ind: E) -> u32 { |
13 | // Canary: we should be able to optimize out the bounds check, but we need | |
14 | // to track the range of the discriminant result in order to be able to do that. | |
15 | // oli-obk tried to add that, but that caused miscompilations all over the place. | |
16 | // CHECK: panic_bounds_check | |
6a06907d XL |
17 | x[ind as usize] |
18 | } |