Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beta miscompiles match when a pattern has a range including signed minimum #58067

Closed
tspiteri opened this issue Feb 2, 2019 · 3 comments
Closed
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tspiteri
Copy link
Contributor

tspiteri commented Feb 2, 2019

fn main() {
    let x = match 1i8 {
        -0x80..=-1 => -99,
        0..=10 => 0,
        _ => 99,
    };
    println!("{}", x);
}

This prints -99 instead of 0.

Changing the first pattern to -0x80 | -0x7f..=-1 => -99, will work around the issue.

Changing it to -0x80..=-0x7f | -0x7e..=-1 reintroduces the issue.

@Centril Centril added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Feb 2, 2019
@Centril
Copy link
Contributor

Centril commented Feb 2, 2019

cc @varkor -- is this the same as the bug you fixed in #57978?

@memoryruins
Copy link
Contributor

@Centril It is. the example on nightly now prints 0, as well as the -0x80..=-0x7f | -0x7e..=-1 version
rust version 1.34.0-nightly (852701ad6 2019-02-01)

@tspiteri thank you for reporting! the fix was accepted for beta backport and will be on there soon ^^

@Centril Centril closed this as completed Feb 2, 2019
@tspiteri
Copy link
Contributor Author

tspiteri commented Feb 2, 2019

Works in updated nightly, thanks! I didn't find the dup as I looked in open issues only, so I missed #57894 which was closed a couple of hours earlier!

brenzi pushed a commit to encointer/substrate-fixed that referenced this issue Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants