https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67618
Marc Glisse changed:
What|Removed |Added
Component|middle-end |c
--- Comment #7 from Marc Glisse ---
(In
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67618
--- Comment #4 from Daniel Gutson
---
(In reply to Andreas Schwab from comment #3)
> Trying to read the (uninitialized) contents of the allocated memory for x <=
> 12 would be undefined behaviour, so calling calloc instead does not change
> the
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67618
--- Comment #3 from Andreas Schwab ---
Trying to read the (uninitialized) contents of the allocated memory for x <= 12
would be undefined behaviour, so calling calloc instead does not change the
defined behaviour.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67618
--- Comment #2 from Daniel Gutson
---
(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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67618
--- Comment #1 from Marc Glisse ---
Why do you call it wrong? It is always legal to replace malloc with calloc, 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.