https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67618
--- Comment #2 from Daniel Gutson <daniel.gutson at tallertechnologies dot com> --- (In reply to Marc Glisse from comment #1) > Why do you call it wrong? It is always legal to replace malloc with calloc, Have you seen the 'if' condition? The optimization ignores it completely. > and if we do it, the memset becomes useless. It may not be optimal from a > performance POV, but I don't see where it breaks anything. > > As for the infinite loop, that's a know problem not specific to this > function and there are already several PRs/emails about it. When you compile > the C library itself, you are supposed to pass some options to gcc so it > knows not to do that.