You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code in memory.rs emits strange assembly code causing an infinite loop:
// T is specialized to some struct sized 336..#[naked]#[inline(never)]#[link_section = ".text.copy_user"]unsafeextern"C"fnwrite_user<T>(dst:*mutT,src:*constT) -> usize{
dst.copy_from_nonoverlapping(src,1);0}
Generated assembly:
ffffffffc02000d6 <_ZN5rcore6memory12copy_to_user10write_user17h75f60bbde319fcafE>:ffffffffc02000d6: 15000613 li a2,336// struct size. 3rd argument of memcpy.ffffffffc02000da: 00086097 auipc ra,0x86// WHY IS IT USING ra FOR INTERMEDIATE ADDRESS CALCULATION?ffffffffc02000de: 0f0080e7 jalr 240(ra) # ffffffffc02861ca <memcpy> // now ra = ffffffffc02000e2 <li a0, 0>ffffffffc02000e2: 4501 li a0,0// BANG!ffffffffc02000e4: 8082 ret// goto BANG!
It seems that rustc optimizing copy_from_nonoverlapping into memcpy (in the naked function) results in this issue, but I'm not sure.
The text was updated successfully, but these errors were encountered:
The following code in
memory.rs
emits strange assembly code causing an infinite loop:Generated assembly:
It seems that
rustc
optimizingcopy_from_nonoverlapping
intomemcpy
(in the naked function) results in this issue, but I'm not sure.The text was updated successfully, but these errors were encountered: