[Bug tree-optimization/79716] memset followed by overwrite not eliminated

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Feb 27 10:41:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79716

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
If we want to do something about this, we should do it regardless if user wrote
it as p = malloc (n); memset (p, 0, n); or p = calloc (n, 1); or p = calloc (1,
n); - if such a calloc is followed by overwriting all bytes in it, we can
transform the calloc back to malloc.  We need to be careful about padding bits
though.


More information about the Gcc-bugs mailing list