{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/26468","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/26468/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/26468/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/26468/events","html_url":"https://github.com/rust-lang/rust/issues/26468","id":89906707,"number":26468,"title":"Pattern match incorrectly optimized out (bad range info handling in LLVM?)","user":{"login":"rprichard","id":1572855,"avatar_url":"https://avatars.githubusercontent.com/u/1572855?v=3","gravatar_id":"","url":"https://api.github.com/users/rprichard","html_url":"https://github.com/rprichard","followers_url":"https://api.github.com/users/rprichard/followers","following_url":"https://api.github.com/users/rprichard/following{/other_user}","gists_url":"https://api.github.com/users/rprichard/gists{/gist_id}","starred_url":"https://api.github.com/users/rprichard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rprichard/subscriptions","organizations_url":"https://api.github.com/users/rprichard/orgs","repos_url":"https://api.github.com/users/rprichard/repos","events_url":"https://api.github.com/users/rprichard/events{/privacy}","received_events_url":"https://api.github.com/users/rprichard/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-wrong","name":"I-wrong","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-06-21T12:43:49Z","updated_at":"2015-06-22T09:41:21Z","closed_at":null,"body":"```rust\r\n#[derive(Copy, Clone, Eq, PartialEq, Debug)]\r\n#[allow(dead_code)]\r\nenum BarMode {\r\n    Bar1,\r\n    Bar2,\r\n}\r\n\r\n#[derive(Copy, Clone, Eq, PartialEq, Debug)]\r\n#[allow(dead_code)]\r\nenum Mode {\r\n    Foo(u8),\r\n    Bar(BarMode),\r\n}\r\n\r\n#[inline(never)]\r\nfn broken(mode: &Mode) -> u32 {\r\n    for _ in 0..1 {\r\n        match *mode {\r\n            Mode::Bar(BarMode::Bar1) => { return 17 }\r\n            Mode::Foo(5) => { return 19 }\r\n            _ => {}\r\n        }\r\n    }\r\n    return 42;\r\n}\r\n\r\nfn main() {\r\n    let mode = Mode::Foo(5);\r\n    assert_eq!(broken(&mode), 19);\r\n}\r\n```\r\n\r\nThis test program should exit quietly, but with `rustc -O`, it instead fails the assertion:\r\n```\r\nthread '<main>' panicked at 'assertion failed: `(left == right) && (right == left)` (left: `42`, right: `19`)', redux.rs:29\r\n```\r\n\r\n```\r\nrprichard@ryan:~/mess/redux$ rustc --version --verbose\r\nrustc 1.2.0-nightly (20d23d8e5 2015-06-18)\r\nbinary: rustc\r\ncommit-hash: 20d23d8e57c0313c811135535d6872463cc6525d\r\ncommit-date: 2015-06-18\r\nhost: x86_64-unknown-linux-gnu\r\nrelease: 1.2.0-nightly\r\n```\r\n\r\nI also tested a really old 32-bit compiler, and it also failed:\r\n```\r\nrprichard@ryan:~/mess/redux$ rustn32 --version --verbose\r\nrustc 1.0.0-nightly (c89de2c56 2015-03-28) (built 2015-03-29)\r\nbinary: rustc\r\ncommit-hash: c89de2c56baeb61e7cc434924dcc8bedd32b26b8\r\ncommit-date: 2015-03-28\r\nbuild-date: 2015-03-29\r\nhost: i686-unknown-linux-gnu\r\nrelease: 1.0.0-nightly\r\n```\r\n\r\n\r\nThis test case is reduced from #25919.\r\n"},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/114051797","html_url":"https://github.com/rust-lang/rust/issues/26468#issuecomment-114051797","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/26468","id":114051797,"user":{"login":"dotdash","id":230962,"avatar_url":"https://avatars.githubusercontent.com/u/230962?v=3","gravatar_id":"","url":"https://api.github.com/users/dotdash","html_url":"https://github.com/dotdash","followers_url":"https://api.github.com/users/dotdash/followers","following_url":"https://api.github.com/users/dotdash/following{/other_user}","gists_url":"https://api.github.com/users/dotdash/gists{/gist_id}","starred_url":"https://api.github.com/users/dotdash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dotdash/subscriptions","organizations_url":"https://api.github.com/users/dotdash/orgs","repos_url":"https://api.github.com/users/dotdash/repos","events_url":"https://api.github.com/users/dotdash/events{/privacy}","received_events_url":"https://api.github.com/users/dotdash/received_events","type":"User","site_admin":false},"created_at":"2015-06-22T09:41:21Z","updated_at":"2015-06-22T09:41:21Z","body":"Thanks Ryan! Indeed LLVM replaces the load with another disregarding the range information."}}