This is the mail archive of the
mailing list for the GCC project.
Re: [tree-ssa] dead const/pure/alloca call removal
Gabriel Dos Reis <firstname.lastname@example.org> writes:
> Jason Merrill <email@example.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 <firstname.lastname@example.org>