Open
Description
#![no_std]
#![no_builtins]
#[no_mangle]
#[inline(never)]
pub unsafe fn set_bytes_bytes(mut s: *mut u8, c: u8, n: usize) {
let end = s.add(n);
while s < end {
*s = c;
s = s.add(1);
}
}
Even with the #![no_builtins]
attribute, the above loop is replaced by a call to memset
. This is problematic when compiling compiler_builtins
, because memset
end up recursively calling itself.
000003bc <set_bytes_bytes.constprop.0>:
3bc: 9c 21 ff f8 l.addi r1,r1,-8
3c0: 18 a0 00 08 l.movhi r5,0x8
3c4: 18 80 00 00 l.movhi r4,0x0
3c8: d4 01 80 00 l.sw 0(r1),r16
3cc: d4 01 48 04 l.sw 4(r1),r9
3d0: 04 00 00 02 l.jal 3d8 <set_bytes_bytes.constprop.0+0x1c>
3d4: 1a 00 00 00 l.movhi r16,0x0
3d8: aa 10 52 08 l.ori r16,r16,0x5208
3dc: e2 10 48 00 l.add r16,r16,r9
3e0: 04 00 0c 4a l.jal 3508 <memset>
3e4: 84 70 00 0c l.lwz r3,12(r16)
3e8: 85 21 00 04 l.lwz r9,4(r1)
3ec: 86 01 00 00 l.lwz r16,0(r1)
3f0: 44 00 48 00 l.jr r9
3f4: 9c 21 00 08 l.addi r1,r1,8