-
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
regression: unit test coretest::num::test_i32f64
fails on some targets
#36518
Comments
Yay smoke! |
Float ABI mismatch maybe? We recently switched MIPS to a different float ABI in rustc side, perhaps compiler-rt simply didn’t follow the suite? |
triage: P-high |
More details:
I'm inclined to think that the
It's possible. We may not be compiling |
After spending much time to establish a test environment, I can reproduce the issue and have found at least one bug in the compiler-rt software floating point routines. In particular, this line: https://github.com/rust-lang/compiler-rt/blob/master/lib/floatsidf.c#L35 to save you the trouble of following the link, its this: if (a < 0) {
sign = signBit;
a = -a;
} That does not properly handle the case where It needs to instead start by promoting
(Incidentally, I found this bug relatively quickly because I decided to take the C code, once I found it, and port it to Rust before doing things like instrumenting it to inspect the intermediate results. And of course (ta da!) our arithmetic overflow checking catches this case.) |
Bravo! Overflow checks pay off. 👏
If you still have your port around, we'd be happy to integrate it into rustc-builtins, where we are porting compiler-rt intrinsics to Rust. We'll integrate rustc-builtins into rust-lang/rust at some point the future (hopefully, soon). |
@japaric yeah I'm still actively working on the port. (That negation issue I raised above is only the first arithmetic overflow that was detected along the control flow; I'm now dissecting a second overflow to determine if it is a mistake in the port or another bug in the original code.) |
(further update: comments in code further down indicate that they are aware of potential for INT_MIN to leak in, which means I was wrong up above; but still, seems like something is wrong with this code.) |
Oh is negating |
Seems like if I revise the code to convert the parameter to an |
Update src/compiler-rt to incoporate fix for UB in floatsidf. Update src/compiler-rt to incoporate fix for UB in floatsidf. Fix #36518
Found using smoke.
Affected targets:
arm-unknown-linux-gnueabi
mips-unknown-linux-musl
mipsel-unknown-linux-musl
STR
Output
Comments
-O
) enabled.is the recent change related to compiler-rt intrinsics: crate-ify compiler-rt into compiler-builtins #35021. Because this test is likely to
involve some compiler-rt intrinsic for the affected targets (no FPU).
bug/failure.
Meta
cc @alexcrichton @brson
The text was updated successfully, but these errors were encountered: