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


Gabriel Dos Reis <gdr@integrable-solutions.net> writes:

> Jason Merrill <jason@redhat.com> writes:
> | Why do you think it is relevant whether or not GCC provides the
> | implementation?
> 
> If GCC provides the implementation, it can pretend it knows what it does.
> Currently, as GCC does not provide the implementation, it cannot
> pretend it knows all the effects of calling malloc.  What it can
> assume is that the return value, if non-NULL, obeys the non-aliasing
> requirement. It can't assume about side-effect beyond that property.
> That matches current parctice.

Are you saying that GCC *should* provide malloc, just to enable this
optimization?  That seems excessive, especially since the optimisation
under discussion causes malloc to *not* be called.

Or are you saying that this optimisation should be enabled only on
those systems where we know how malloc behaves and/or that do not let
the user replace the malloc library?  (Darwin is such a system.)

[However, I can see that providing a malloc library would be helpful.
It would be nice to be able to execute constructors at compile-time;
often they have no side-effects other than calling 'new' and setting
ethe contents of global objects or malloced memory.  But then you need
to arrange for 'delete' to work once the program is running, so you
really want information about malloc's internals.]

-- 
- Geoffrey Keating <geoffk@geoffk.org>


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