-
Notifications
You must be signed in to change notification settings - Fork 232
__aeabi_lmul on thumbv6m-none-eabi #127
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
Comments
I think this is how the disassembly was produced:
$ edit src/main.rs && cat $_
#![feature(compiler_builtins_lib)]
#![feature(lang_items)]
#![no_main]
#![no_std]
extern crate compiler_builtins;
use core::ptr;
#[no_mangle]
pub fn _start() -> ! {
let x = unsafe {
ptr::read_volatile(0x0 as *const u32)
};
let y = x * (48000000 / 1000000) / 3;
loop {}
}
#[lang = "panic_fmt"]
#[no_mangle]
fn panic_fmt() {}
#[no_mangle]
pub fn __aeabi_unwind_cpp_pr0() {}
|
@japaric correct. For completeness here's the full function.
|
I had a look at the LLVM IR on playground and it seems that |
@parched Hi, thanks for taking the time to look at this! Do you happen to have a rough patch idea for that? I am unfortunately not yet deep enough into the compiler-rt code but am facing the same issue. |
@parched Wow, thanks for the fast patch. I can confirm this works for me and stops the infinite recursion from happening. |
mul.rs: use wrapping_mul to avoid infinite recursion rustc in debug mode with a plain multiplication will call @llvm.umul.with.overflow.* which may call the builtin resulting in infinite recursion. Fixes #127. Cc @nezza this should be the fix you can try. Note I made this patch in github's web Ui so it's completely untested.
127: update changelog; add more copyright notices r=japaric a=japaric Co-authored-by: Jorge Aparicio <[email protected]>
Managed to track a crash when using lmul down to what seems to be a stack overflow, with a loop between the __aeabi_lmul and __muldi3 functions. I think it's due to 0x6ccc in this dump.
The text was updated successfully, but these errors were encountered: