[Bug tree-optimization/67618] malloc+memset optimization breaks code
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Sep 17 20:23:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67618
Marc Glisse <glisse at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|c |tree-optimization
--- Comment #8 from Marc Glisse <glisse at gcc dot gnu.org> ---
(bugzilla bug that reset the component...)
(In reply to Daniel Gutson from comment #6)
> That's why the 'if (ptr != NULL)' should not be ignored, which currently is.
> The 'if' prevents the UB.
Uh, if you consider it UB, I don't understand the problem. At runtime, either
malloc succeeded and the transformation is fine, or x<=12 and the
transformation is fine, or the call to memset is undefined behavior so anything
is fine (including the transformation). Unless you explicitly want to catch the
trap, I don't understand what you are saying. Could you detail step by step
where a well-defined behavior in the original program is turned into a
different behavior in the optimization?
More information about the Gcc-bugs
mailing list