Skip to content

llvm lint: "unreachable immediately preceded by instruction without side effects" #48228

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

Open
matthiaskrgr opened this issue Feb 15, 2018 · 2 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

reduced from https://github.com/alexcrichton/rustc-demangle/

pub fn demangle(inner: &str) {
    inner.chars().peekable().by_ref().take(0).count();
}
$ RUSTFLAGS="-C passes=lint"  cargo build 

   Compiling rustc-demangle v0.1.5 (file:///tmp/rustc-demangle)
Unusual: unreachable immediately preceded by instruction without side effects
  unreachable, !dbg !33
    Finished dev [unoptimized + debuginfo] target(s) in 0.31 secs

//cc #7463

@bstrie bstrie added the A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. label Feb 19, 2018
@XAMPPRocky XAMPPRocky added C-enhancement Category: An issue proposing an enhancement or a PR with one. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 7, 2018
@istankovic
Copy link
Contributor

@matthiaskrgr is this still relevant? I was not able to reproduce this with recent nightly.

@Mark-Simulacrum
Copy link
Member

I can still reproduce this, compiling the example given above with rustc +nightly -Cpasses=lint -g t.rs --crate-type=lib --emit=llvm-ir gives me:

Unusual: unreachable immediately preceded by instruction without side effects
  unreachable, !dbg !30

Though I can't find that line in the actual LLVM IR output, even with -Cno-prepopulate-passes.

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. C-enhancement Category: An issue proposing an enhancement or a PR with one. 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

5 participants