-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Miscompilation(s) due to MIR inlining #105344
Comments
Looks like the @rustbot label +A-mir-opt +I-unsound |
The same patch exposes the miscompile in diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs
index bf670c5c26a..02a401e7c63 100644
--- a/compiler/rustc_mir_transform/src/inline.rs
+++ b/compiler/rustc_mir_transform/src/inline.rs
@@ -343,8 +343,8 @@ fn check_codegen_attributes(
InlineAttr::Never => return Err("never inline hint"),
InlineAttr::Always | InlineAttr::Hint => {}
InlineAttr::None => {
- if self.tcx.sess.mir_opt_level() <= 2 {
- return Err("at mir-opt-level=2, only #[inline] is inlined");
+ if self.tcx.sess.mir_opt_level() <= 1 {
+ return Err("at mir-opt-level=1, only #[inline] is inlined");
}
}
} Then this produces failing tests:
|
Does |
Nope. Nothing at all. |
I minimized the fn main() {
TranslatorI.visit_pre();
}
impl TranslatorI {
fn visit_pre(self) {
Some(())
.map(|_| self.flags())
.unwrap_or_else(|| self.flags());
}
}
struct TranslatorI;
impl TranslatorI {
fn flags(&self) {}
} Debug info is required to trigger the SIGILL. [profile.release]
debug = true or just Interestingly, adding I used dustmite for a bunch of the work and it worked really well (apart of being quite annoying to set up), I can recommend it. Special thanks to @Byter09 for helping me with that :D |
searched nightlies: from nightly-2018-11-01 to nightly-2022-12-06 bisected with cargo-bisect-rustc v0.6.4Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --access github --script ./script.sh --preserve |
I also found an ICE in
|
searched nightlies: from nightly-2022-01-01 to nightly-2022-12-05 bisected with cargo-bisect-rustc v0.6.5Host triple: x86_64-unknown-linux-gnu cargo bisect-rustc --script script --start 2022-01-01 --end 2022-12-05 |
These two issues are unrelated, can we split them up? @Nilstrieb 's is caused by a bug somewhere in codegen, Godbolt. The LLVM IR has UB on line 66, where a load is marked @rustbot label +I-wrong -I-unsound +A-codegen +A-llvm |
I don't know what sets that bug off, but it's worth pointing out that I have no reason to believe that it requires |
@Nilstrieb could you share somehow how you did get dustmite to work? |
@matthiaskrgr I was the one that got it working for @Nilstrieb. DustMite wasn't really developed for Rust, so some syntax is problematic for it, but in 99% of cases it works just fine. I have it running right now reducing my library to a ICE at the moment, because I can't figure it out myself. The basic idea is to first get it reliably running without DustMite. Once you have a valid test case that returns 0 if the problem occurs, you can use that to let DustMite have a go. Also, Back then, I wrote the minimizer for Saltwater: https://github.com/jyn514/saltwater/tree/master/minimizer |
@JakobDegen I split the issue that bisects to DestProp out into #105428 |
With those two issues separated out, is there still anything in this one that hasn't been investigated? The core simd ones I suppose? |
I bisected this: #![feature(portable_simd)]
fn main() {
use core::simd::Simd;
let a = Simd::from_array([0, 4, 1, 5]);
let b = Simd::from_array([2, 6, 3, 7]);
let (x, y) = a.deinterleave(b);
assert_eq!(x.to_array(), [0, 1, 2, 3]);
assert_eq!(y.to_array(), [4, 5, 6, 7]);
} back to nightly-2021-11-14 (which is too long ago to have CI toolchains), best guess is that this has reproduced since #89167. Which as far as I can tell is the PR that introduced |
Looks like everything has been split out! Thanks everyone! |
I just figured I'd try running some tests and benchmarks with
-Zmir-opt-level=3
and it is not going well. I realize I'm painting a rather grim picture here, but to be clear some code does in fact seem to compile correctly.On commit
e1d819583f0bf13b016b119c1c2c43e6d3979450
I ran:And I see 6 test failures in
core_simd
all like this:I also tried running the
tinyvec
benchmark suite, commitcd8b94964ffd857119c2095ad3d232a4e16a2ad0
of https://github.com/lokathor/tinyvec(this is not supposed to panic)
I also tried running the test suite for https://github.com/rust-lang/regex on commit
ac2d0e1b33b4674ad9b26266ef4b828d7200ec0f
The text was updated successfully, but these errors were encountered: