This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] Marking C++ new operator as malloc?
On 12 Sep 2007 08:13:31 -0700, Ian Lance Taylor <iant@google.com> wrote:
> "Richard Guenther" <richard.guenther@gmail.com> writes:
>
> > > CHANGE_DYNAMIC_TYPE_EXPR has the target type, of course. So perhaps
> > > we need __attribute__ ((change_dynamic_type))?
> > >
> > > Or actually of course __attribute__ ((malloc)) is fine but we could
> > > throw in a CHANGE_DYNAMIC_TYPE_EXPR after any call to such a
> > > function. That ought to do the right thing for C malloc
> > > implementations as well, I think.
> >
> > We should need this only if inlining malloc functions in C.
>
> Which we will presumably do at some point. After all, it's not just
> malloc--it's any function with __attribute__ ((malloc)), which can
> include user functions.
Btw, I filed PR33407 to hint that we need the CHANGE_DYNAMIC_TYPE_EXPR
trick for the usual operator new
as well.
And yes, we would need to fix all __attribute__((malloc)) functions
in C with the same thing - the problem I see in C is that we don't
know the type we are "converting" to ;)
Richard.