[Bug c/67618] malloc+memset optimization breaks code
daniel.gutson at tallertechnologies dot com
gcc-bugzilla@gcc.gnu.org
Thu Sep 17 19:48:00 GMT 2015
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.
More information about the Gcc-bugs
mailing list