This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/79716] memset followed by overwrite not eliminated
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 27 Feb 2017 10:41:43 +0000
- Subject: [Bug tree-optimization/79716] memset followed by overwrite not eliminated
- Auto-submitted: auto-generated
- References: <bug-79716-4@http.gcc.gnu.org/bugzilla/>
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.