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

ICE / LLVM ERROR with tuple structure match #14308

Closed
alxgnon opened this issue May 20, 2014 · 1 comment · Fixed by #14313
Closed

ICE / LLVM ERROR with tuple structure match #14308

alxgnon opened this issue May 20, 2014 · 1 comment · Fixed by #14313
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@alxgnon
Copy link
Contributor

alxgnon commented May 20, 2014

$ rustc --version
rustc 0.11.0-pre-nightly (6291955 2014-05-19 23:41:20 -0700)
host: x86_64-apple-darwin

Input

struct A(int);

pub fn main() {
    match A(0) {
        A(..) => 0,
    };
}

Output

Basic Block in function '_ZN4main20h2e73f07be5542c69jaa4v0.0E' does not have terminator!
label %entry-block
LLVM ERROR: Broken function found, compilation aborted!

Input

struct A(int);

pub fn main() {
    match A(0) {
        A(0) => 1,
        A(..) => 0,
    };
}

Output

llvm_err.rs:6:9: 6:14 error: internal compiler error: expected an identifier pattern but found p: pat(21: A(..))
llvm_err.rs:6         A(..) => 0,
                      ^~~~~
lilyball added a commit to lilyball/rust that referenced this issue May 21, 2014
Enum wildcard patterns in match behave wrong when applied to tuple
structs. They either ICE or cause an LLVM error.
lilyball added a commit to lilyball/rust that referenced this issue May 21, 2014
lilyball added a commit to lilyball/rust that referenced this issue May 21, 2014
Consider PatEnums constructed with A(..) to be candidates for tuple
struct patterns, not just ones constructed with A(a,b,c). If these
patterns shouldn't be valid tuple struct patterns (as they're equivalent
to _), this needs to be caught before we get to trans.

Fixes rust-lang#14308.
@alxgnon
Copy link
Contributor Author

alxgnon commented May 23, 2014

Yay!

flip1995 pushed a commit to flip1995/rust that referenced this issue Feb 27, 2025
…lang#14308)

The `looks_like_refdef` function was assuming the range was valid, this
just adds a check to ensure that is the case. It also works around a
subtraction underflow due to the same invalid range.

changelog: [`doc_nested_refdefs`]: Fix rust-lang#14287 by avoiding invalid ranges
flip1995 pushed a commit to flip1995/rust that referenced this issue Mar 20, 2025
…#14310)

changelog: [`implicit_saturating_sub`, `inverted_saturating_sub`]:
extend lints from local variables to side-effect free expressions

Noticed when rust-lang#14308 introduced an implicit `saturating_sub` operation
and didn't get tagged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants