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: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Jan Hubicka <hubicka at ucw dot cz>
- Cc: Alexander Monakov <amonakov at ispras dot ru>, "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 12:05:10 -0500
- 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> <20130822152111 dot GB19256 at kam dot mff dot cuni dot cz> <alpine dot LNX dot 2 dot 00 dot 1308221932570 dot 30125 at monopod dot intra dot ispras dot ru> <CAAiZkiD_CM+7E5o_jZESG=iLVFPGGh2NNvnha9LFaYmy7aCWFQ at mail dot gmail dot com> <20130822160838 dot GB24022 at kam dot mff dot cuni dot cz>
On Thu, Aug 22, 2013 at 11:08 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
>>
>> This should be a C++ front-end bug. The specific operator new
>> from <new> used in this placement-new should be folded,
>> even if -fno-inline. Jason, is this something easily fixable?
>>
>> After overload resolution, we know exactly which operator new
>> we are picking, and we know it is the one coming from the
>> implementation with its definition. So we should be good to go.
>
> Great! I think this is quite important starting point to get some
> heap optimizations done in middle-end :)
In the placement-form, no allocation is done, so the fact that we are
not emitting identity opcode is a bug :-)
The ground for this is (quoting C++11, but this has been true forever)
18.6.1.3/1:
These functions are reserved, a C++ program may not define functions
that displace the versions in the Standard C++ library (17.6.4). The
provisions of (3.7.4) do not apply to these reserved placement forms
of operator new and operator delete.
-- Gaby