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: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 May 2007 15:20:15 -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 #62 from rguenth at gcc dot gnu dot org 2007-05-14 16:20 -------
We ICE with
template <class T, class T2, int D>
class Vector
{
public:
Vector()
{
for (int i = 0; i < D; ++i)
new (&x_m[i]) T2();
}
T2& operator[](int i) { return *reinterpret_cast<T2*>(&x_m[i]); }
private:
T x_m[D];
};
void foo(Vector<double, long, 3> *m)
{
Vector<double, long, 3> v;
v[0] = 1;
v[1] = 2;
v[2] = 3;
*m = v;
}
(adjust the storage type to be of same size for double/long):
Program received signal SIGSEGV, Segmentation fault.
0x0000000000b11a5e in unmodifiable_var_p (var=0x0)
at /space/rguenther/src/svn/trunk/gcc/tree-flow-inline.h:1598
1598 if (TREE_CODE (var) == SSA_NAME)
#0 0x0000000000b11a5e in unmodifiable_var_p (var=0x0)
at /space/rguenther/src/svn/trunk/gcc/tree-flow-inline.h:1598
#1 0x0000000000b194c3 in may_alias_p (ptr=0x2b537d358210, mem_alias_set=2,
var=0x2b537d359e00, var_alias_set=3, alias_set_only=0 '\0')
at /space/rguenther/src/svn/trunk/gcc/tree-ssa-alias.c:2685
#2 0x0000000000b17f2b in add_flow_insensitive_var_aliases (ai=0x14d7890,
pvar=0x2b537d358210, set=2, tag=0x2b537d356ba0)
at /space/rguenther/src/svn/trunk/gcc/tree-ssa-alias.c:2190
#3 0x0000000000b184d3 in compute_change_dynamic_type_aliasing (
vcdt=0x2b537d357a00, vai=0x14d7890)
at /space/rguenther/src/svn/trunk/gcc/tree-ssa-alias.c:2242
#4 0x000000000098a387 in pointer_set_traverse (pset=0x14e4e10,
fn=0xb17f84 <compute_change_dynamic_type_aliasing>, data=0x14d7890)
at /space/rguenther/src/svn/trunk/gcc/pointer-set.c:181
#5 0x0000000000b18719 in compute_flow_insensitive_aliasing (ai=0x14d7890)
at /space/rguenther/src/svn/trunk/gcc/tree-ssa-alias.c:2295
#6 0x0000000000b15b17 in compute_may_aliases ()
where in may_alias_p the ptr we passed does not have a symbol memory tag
associated. (but var is SFT.3)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29286