[Bug tree-optimization/78902] Missed malloc optimizations: malloc w/o LHS and zero argument
marxin at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 22 14:31:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78902
--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #2)
> The p=malloc(0) transformation looks strange.
> (I never know if we are supposed to unlink_stmt_vdef, etc)
Yep, it's strange, should be p = NULL. As mentioned in MAN page:
If size is 0, then malloc() returns either NULL, or a unique pointer value that
can later be successfully passed to free().
I'll prepare regular patch and send it to ML.
More information about the Gcc-bugs
mailing list