This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/29286] [4.0/4.1/4.2/4.3 Regression] placement new does not change the dynamic type as it should
- From: "mark at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 May 2007 23:41:49 -0000
- Subject: [Bug libstdc++/29286] [4.0/4.1/4.2/4.3 Regression] placement new does not change the dynamic type as it should
- References: <bug-29286-10053@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #77 from mark at codesourcery dot com 2007-05-17 00:41 -------
Subject: Re: [4.0/4.1/4.2/4.3 Regression] placement
new does not change the dynamic type as it should
ian at airs dot com wrote:
> I don't believe that the C++ standards writers really meant to eliminate TBAA.
> And that is the inevitable consequence of the dynamic memory type approach if
> you are allowed to change the dynamic type in a function.
I agree with Ian.
I think there is good evidence that the authors of the standard intended
C++ to be *more* typesafe than C, and we should read the standard in
that way. It's unfortunate that neither the C or C++ standards is very
precise about various aspects of the memory model, but that is what it
is. I think trying to read the standard to divine the answers to these
questions is essentially futile; this is a situation where we should
accept that the standard doesn't say, and do our best to balance
performance with existing practice and expectations.
I don't fully understand the point of Comment #73. I thought the whole
point of this series of patches was to make the compiler understand that
memory returned by placement new could alias other memory, or to
otherwise introduce a barrier that would prevent the compiler from
reordering accesses across the call to operator new. If that's the
case, why does the post-patch compiler still think that the writes to
"f" and "l" don't alias?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29286