This is the mail archive of the
mailing list for the GCC project.
Re: [tree-ssa] dead const/pure/alloca call removal
- From: Michael Matz <matz at suse dot de>
- To: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Cc: Jason Merrill <jason at redhat dot com>,Daniel Jacobowitz <drow at mvista dot com>, <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 10 Nov 2003 04:40:20 +0100 (CET)
- Subject: Re: [tree-ssa] dead const/pure/alloca call removal
On 9 Nov 2003, Gabriel Dos Reis wrote:
> | Why do you see this as different from strlen?
> memory allocation is fundamentally different from counting the number
> of characters in a string.
This is an interesting statement from a language lawyer. How exactly have
you measured that difference, and why is it fundamental, and why is
malloc() on the we-shouldn't-do-this side, but not strlen()?
After all, using your argumentation, also some strlen implementation could
have side-effects (like for instance counting the number of them being
called, like in profiling libraries. Oh wait those already exist), and
following from that we also shouldn't optimize any calls to strlen.
No no, you are wrong. Any such side-effects would be outside the
standard, and for such uses we have -fno-builtin-FUNCTION.
Btw. in case this was already forgotten in this thread. The proposed
patch only deleted alloca() calls (which btw. is provided by GCC, not that
this would matter), and didn't deal with malloc/free at all.