-
Notifications
You must be signed in to change notification settings - Fork 212
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
thumbv6m: debug assertion in divmoddi4 #150
Comments
Another case that results in an assertion |
Testing all these intrinsics fail due to this debug assertion
|
This is probably fix by rust-lang/llvm#79 |
@japaric I think this should be fixed in the latest nightly now that rust-lang/rust#42410 has landed. |
I tested with |
Ok, that commit had the fix in, so this must be caused by something else. |
@japaric I'd like to debug this, how exactly did you run the test? Do I have to build all of std with Xargo for |
@parched I actually ran the whole test suite with $ edit tests/custom.rs && cat $_ #![feature(compiler_builtins_lib)]
#![no_std]
extern crate compiler_builtins;
extern crate utest_cortex_m_qemu;
#[macro_use]
extern crate utest_macros;
macro_rules! panic {
($($tt:tt)*) => {
upanic!($($tt)*);
};
}
use compiler_builtins::int::sdiv::__divmoddi4;
#[test]
fn divmoddi4() {
let (a, b) = (4165187992, 3876330169);
let mut rem = 0;
let c = __divmoddi4(a, b, &mut rem);
} $ xargo test --test custom --target thumbv6m-linux-eabi --features 'mem gen-tests' --no-run
$ qemu-arm target/thumbv6m-linux-eabi/debug/custom-6bc70d2d2f80ab1e
running 1 tests
test divmoddi4 ...
panicked at 'attempt to multiply with overflow', src/int/udiv.rs:95
qemu: uncaught target signal 4 (Illegal instruction) - core dumped
[1] 27726 illegal hardware instruction (core dumped) qemu-arm target/thumbv6m-linux-eabi/debug/custom-6bc70d2d2f80ab1e |
Ok, I've debugged it and looks like LLVM bug for unsigned multiplication with overflow. I'll make a patch. |
Thanks for investigating and working on this @parched ❤️ |
No problem, the fix has been accepted upstream. Once rust-lang/llvm#85 is merged and rust is updated hopefully this will be fixed. |
Update LLVM to fix unsigned multiplication overflow check for some targets, notably ARMv6-M. Fixes rust-lang/compiler-builtins#150
@japaric Do some tests need to be re-enabled now? |
@parched Yes. I'll send a PR later today. (I suspect a nightly with the fix may not be out yet.) |
thumbv7m targets don't have this problem.
The text was updated successfully, but these errors were encountered: