[Bug c/67618] malloc+memset optimization breaks code

2015-09-17 Thread glisse at gcc dot gnu.org
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

[Bug c/67618] malloc+memset optimization breaks code

2015-09-17 Thread daniel.gutson at tallertechnologies dot com
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

[Bug c/67618] malloc+memset optimization breaks code

2015-09-17 Thread sch...@linux-m68k.org
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.

[Bug c/67618] malloc+memset optimization breaks code

2015-09-17 Thread daniel.gutson at tallertechnologies dot com
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

[Bug c/67618] malloc+memset optimization breaks code

2015-09-17 Thread glisse at gcc dot gnu.org
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.