-
Notifications
You must be signed in to change notification settings - Fork 13.3k
incorrect code generation for i686 release build for 1.47 beta and nightly #76042
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
The |
Let's try to find the culprit for this regression. Trying to reduce the example would be nice too. |
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good cc @AminArria @camelid @chrissimpkins @contrun @DutchGhost @elshize @ethanboxx @h-michael @HallerPatrick @hdhoang @hellow554 @imtsuki @kanru @KarlK90 @LeSeulArtichaut @MAdrianMattocks @matheus-consoli @mental32 @nmccarty @Noah-Kennedy @pard68 @PeytonT @pierreN @Redblueflame @RobbieClarken @RobertoSnap @robjtede @SarthakSingh31 @senden9 @shekohex @sinato @spastorino @turboladen @woshilapin @yerke |
Marking this as P-critical based on the wg-prioritization discussion |
I have a reduced test case. /// ```rust
/// assert_eq!(rust76042::foo(), 8);
/// ```
#[inline]
pub fn foo() -> i128 {
bar().0
}
#[inline]
fn bar() -> (i128, bool) {
let a = 0;
let b = 128;
let shift = 4;
let ret = baz(a, b, shift);
// should print "baz(0, 128, 4) -> (8, false)"
println!("baz({}, {}, {}) -> ({}, {})", a, b, shift, ret.0, ret.1);
ret
}
#[inline]
fn baz(a: i128, b: i128, shift: u32) -> (i128, bool) {
if shift == 128 {
(a, false)
} else {
(b >> shift, a >> shift != 0)
}
} Note that if I move the doc test to a lib test, I cannot trigger this bug. On i686 beta/nightly release test, the doc test fails with:
|
Minimized: fn foo(a: i128, b: i128, s: u32) -> (i128, i128) {
if s == 128 {
(0, 0)
} else {
(b >> s, a >> s)
}
}
fn main() {
let r = foo(0, 8, 1);
if r.0 != 4 {
panic!();
}
} rustc --crate-type=bin a.rs --target i686-unknown-linux-gnu -Coverflow-checks=off -Ccodegen-units=1 -Copt-level=1
./a
rustc --crate-type=bin a.rs --target i686-unknown-linux-gnu -Coverflow-checks=off -Ccodegen-units=1 -Copt-level=0
./a
thread 'main' panicked at 'explicit panic', a.rs:11:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
LLVM bug report https://bugs.llvm.org/show_bug.cgi?id=47278. EDIT:
|
LLVM bug 47278 has apparently been fixed in the LLVM tree and its 11.x branch. (I don't really know LLVM, I'm only mentioning this as a comment above mentioned that bug as a possible cause of this issue.) |
@LeSeulArtichaut I don't know how to write this kind of test PR, please go ahead. |
Now the beta is working fine as well for me. |
…r=pnkfelix Add regression test for issue rust-lang#76042 Originally posted in rust-lang#76042 (comment). r? `@pnkfelix`
…laumeGomez Rollup of 6 pull requests Successful merges: - rust-lang#77151 (Add regression test for issue rust-lang#76042) - rust-lang#77996 (Doc change: Remove mention of `fnv` in HashMap) - rust-lang#78463 (Add type to `ConstKind::Placeholder`) - rust-lang#78984 (Rustdoc check option) - rust-lang#78985 (add dropck test for const params) - rust-lang#78996 (add explicit test for const param promotion) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The test passes for 1.46.0 i686 stable release builds, for i686 beta/nightly debug builds, and for x86_64 beta/nightly release builds, but fails for i686 beta/nightly release builds.
CI logs from this code on GitLab:
https://gitlab.com/tspiteri/fixed/-/pipelines/183281142
The text was updated successfully, but these errors were encountered: