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


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


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