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


Hi,

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.


Ciao,
Michael.


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