[Bug libstdc++/29286] [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 gcc-bugzilla@gcc.gnu.org
Fri May 18 16:25:00 GMT 2007



------- Comment #86 from ian at airs dot com  2007-05-18 17:24 -------
Re comment #80, comment #81, comment #82.  My patch handles the placement new
in comment #73 to indicate an alias between double and long.  The mis-ordered
code is actually aliasing int and long.  That aliasing is due to a cast to
(int*).  There is no placement new in that cast.  There is no reason for the
compiler to avoid exchanging the store via int* and the store via long*.  Why
should it?  If you omitted the placement new, this would be a standard aliasing
violation between int and double.  With the placement new, it's still an
aliasing violation between int and long.  The placement new doesn't excuse you
from all aliasing violations: it just excuses you from aliasing violations
involving the actual types in question.

If you want to make a principled argument that placement new excuses you from
all aliasing violations, then again the result is that in a function which uses
placement new we should disable TBAA for that function.  That would be OK with
me and easy to implement.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29286



More information about the Gcc-bugs mailing list