Latest gcc optimizes ptr = malloc(size); memset(ptr, 0, size); to a calloc call. Guess how I implement calloc?
@SortieCat Does -ffreestanding help? You need that for implementing libc functions.
-
-
@RichFelker Yeah. -ffreestanding implies -fno-builtin which implies -fno-builtin-malloc which suppresses that optimization. -
@RichFelker Is -ffreestanding actually required, will -fno-builtin not suffice? I only -ffreestanding kernel code atm. -
.
@RichFelker But the right thing is for GCC to never do that optimization inside calloc. Trying to fix that now. -
@SortieCat "Inside calloc" is not something the compiler can know. calloc could call an extern func (or func ptr) that does malloc+memset. -
@RichFelker A reasonable approximation is just to limit that to functions named calloc, and required other code to disable the optimization.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.