This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Fix placement new if operator new has 2nd argument REFERENCE_TYPE (PR c++/34862)


On Tue, Feb 05, 2008 at 07:59:33PM +0100, Richard Guenther wrote:
> On Feb 5, 2008 7:06 PM, Jason Merrill <jason@redhat.com> wrote:
> > Richard Guenther wrote:
> > > The problem arises at the point of inlining, where the optimizers need to see
> > > that at the _beginning_ of the inlined new operator the dynamic type
> > > of the storage is changing.
> >
> > Why?  The new operator isn't doing anything to the storage.
> 
> In PR33407 an implementation of ::new (called by new expression) might
> choose to zero-initialize storage for example.  But you are probably right,
> as the new type is in effect only at the point the new object is constructed
> which happens by a constructor called on the result pointer.

Zero initialization using e.g. memset would be ok, that's storing using
alias set 0.  But the point where the heap object changes the dynamic type
is IMHO when the operator new returns the pointer to the new type, not before.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]