[Bug target/117831] [RISCV] A dead loop occurs when calculating the multiplication of two uint64 integers under rv32 -Os

fanghuaqi at vip dot qq.com gcc-bugzilla@gcc.gnu.org
Mon Dec 2 03:39:28 GMT 2024


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117831

Huaqi <fanghuaqi at vip dot qq.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fanghuaqi at vip dot qq.com

--- Comment #5 from Huaqi <fanghuaqi at vip dot qq.com> ---
(In reply to Xi Ruoyao from comment #3)
> You are misreading the disassembly.  We actually have
> 
>   42:	00000097          	auipc	ra,0x0
> 			42: R_RISCV_CALL_PLT	__muldi3
> 			42: R_RISCV_RELAX	*ABS*
>   46:	000080e7          	jalr	ra # 42 <.L3+0xa>
> 
> so it's calling a function, not a dead loop.  It's just the actual address
> of the function has not be filled in (the linker should do it) yet.

Hi Ruoyao,

I think `mul_u64` is used to replace the libgcc's implementation `__muldi3`,
which means it should not expect there is a `__muldi3` and call it, how can I
achieve to compile this code and generate correct asm code, without calling
libgcc's `__muldi3`


More information about the Gcc-bugs mailing list