This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ patch] Set attributes for C++ runtime library calls
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Alexander Monakov <amonakov at ispras dot ru>
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>, Jan Hubicka <hubicka at ucw dot cz>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Jason Merrill <jason at redhat dot com>
- Date: Thu, 22 Aug 2013 17:21:11 +0200
- Subject: Re: [C++ patch] Set attributes for C++ runtime library calls
- References: <20130822131927 dot GA18084 at kam dot mff dot cuni dot cz> <CAAiZkiDRZj-Fzy2+zUo9Z2B5ShvJ6K_duNyX1SKfrEZeX1NNZQ at mail dot gmail dot com> <alpine dot LNX dot 2 dot 00 dot 1308221836460 dot 30125 at monopod dot intra dot ispras dot ru>
> On Thu, 22 Aug 2013, Gabriel Dos Reis wrote:
> > > - I would like to recall issue if we can make NEW_EXPR annotated with
> > > MALLOC attribute. Without it, it is basically impossible to track
> > > any dynamically allocated objects in the middle-end
> >
> > operator new is replaceable by user program.
>
> But so is malloc? As I understand, the reason why "malloc" attribute is not
> applicable to operator new is "placement new", which returns aliased memory.
placement new is optimized to nothing, so it should not affect anything here.
MALLOC attribute makes the assumtion that you can not get to the return value of
the function from something that you had previously (i.e. you can not have
existing pointer to that block of memory). So you can not really implement
malloc in the same compilation unit you are using it.
So the existing program needs to overwrite libsup++ symbol like we do with malloc?
Of course with user defineed malloc function we should not propagate the attribute,
but I think we could have it when we end up calling the runtime.
Honza
>
> Alexander