This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/78902] Missed malloc optimizations: malloc w/o LHS and zero argument


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]