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

Daniel Jacobowitz drow@mvista.com
Sun Nov 9 06:05:00 GMT 2003


On Sun, Nov 09, 2003 at 06:51:59AM +0100, Gabriel Dos Reis wrote:
> "Zack Weinberg" <zack@codesourcery.com> writes:
> 
> | Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
> | 
> | > | At least in C, and presumably in C++ with direct calls to malloc/free.
> | >
> | > Again, that is fine *if* GCC is a whole implementation of the compiler
> | > plus the library.  Currently, it is not.  It relies on third party
> | > libraries, and such libraries might be doing additional things like
> | > tracing or implement their own view of memory allocation.
> | 
> | I think this is a bit much.  malloc's behavior is specified by the
> | C standard.
> 
> And the C standard also says the implementation provides malloc().  
> Which GCC does not.  
> 
> In reality, the specification of malloc() as found in the C standard
> does not provide sufficient ground for GCC to willy-nilly elide calls
> to malloc, given that GCC actually does not provide a malloc
> implementation.
> 
> [...]

The implementation provides malloc; GCC is merely a part of the
implementation.  We already assume a conforming library for many
optimizations; glibc doesn't provide strlen either.

I disagree that the C standard's definition is too weak to allow
eliding of calls, as-if.  What problems do you see?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



More information about the Gcc-patches mailing list