This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [tree-ssa] dead const/pure/alloca call removal
"Zack Weinberg" <zack@codesourcery.com> writes:
| 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.
very few useful programs are strictly conforming. I'm NOT convinced GCC
should take that slipery slope.
-- Gaby