This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/81892] suboptimal code for a if (p) free(p) else free(p)
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 21 Aug 2017 08:28:00 +0000
- Subject: [Bug tree-optimization/81892] suboptimal code for a if (p) free(p) else free(p)
- Auto-submitted: auto-generated
- References: <bug-81892-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81892
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |DUPLICATE
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
tail-merging is supposed to handle this I think but it gets defeated by
the removing the dead free(0) call.
We do preserve conditional free as conditional free (as it's faster).
So I think GCC works as designed on the testcase, transforming it to
if (p)
free (p);
at least at -Os we should change the above to free (p) I guess where we
have the duplicate bug for.
*** This bug has been marked as a duplicate of bug 80519 ***