This is the mail archive of the gcc-bugs@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]

[Bug libstdc++/29286] [4.0/4.1/4.2/4.3 Regression] placement new does not change the dynamic type as it should



------- Comment #29 from ian at airs dot com  2007-05-02 16:57 -------
Created an attachment (id=13497)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13497&action=view)
Patch

Here is one approach which fixes the test case.  This introduces a new tree
code, ALIASING_CONVERT_EXPR.  It is conveyed into RTL via a flag on REGS:
REG_ALIAS_ALL.   I didn't try to really union the alias sets, I just said that
the result of placement new can alias anything.  This patch is essentially
untested.

I'm not very happy with this approach because it doesn't fail safe: it's too
easy to lose the special aliasing, and then the problem appears again, but only
with a more complicated test case.  A safer approach might be to change the
type returned by placement new and mark it as TYPE_REF_CAN_ALIAS_ALL, but then
I'm worried about type conversion and type comparison problems, since it isn't
actually a different type.


-- 


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


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