This is the mail archive of the gcc-patches@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]

Re: [tree-ssa] dead const/pure/alloca call removal


Falk Hueffner <falk.hueffner@student.uni-tuebingen.de> writes:

> "Zack Weinberg" <zack@codesourcery.com> writes:
>
>> I don't know what the right thing is, but I'd point out that this
>> optimization applies to all functions whose side effect is to
>> allocate a new block of memory, the sole pointer to which is
>> returned.  malloc and calloc (but not realloc) are the obvious
>> examples.
>
> No, they set errno.

Yah, but an s.c. program cannot make any assumptions about the value
of errno unless it has just called a library function and observed it
to fail, so if the return value of malloc is ignored, the call to
malloc can safely be deleted.

zw


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