On Thu, Aug 22, 2013 at 11:08 AM, Jan Hubicka <hubi...@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