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 Regression] placement new does not change the dynamic type as it should
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Sep 2006 16:58:07 -0000
- Subject: [Bug libstdc++/29286] [4.0/4.1/4.2 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 #13 from pinskia at gcc dot gnu dot org 2006-09-29 16:58 -------
And here is a testcase that fails also for 4.0.0 and self contained also:
#include <new>
int foo(int n, int *f, long *f1)
{
long t = 0;
*f = 1;
long *fp = new(f) long;
*fp = 1;
for (int i=0; i<n; ++i)
{
t += *fp;
int *b = new (f) int;
*b = i + *f1;
fp = new (f) long;
*fp = t*t;
}
t+=*fp;
return t+*f1;
}
extern "C" void abort ();
int main(void)
{
if (sizeof(int) != sizeof(long)
return 0;
int *a = new int;
long *b = new long;
if (foo(2, a, b) != 6)
abort ();
return 0;
}
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |4.0.0 4.1.0 4.2.0
Known to work|4.1.1 |3.4.0
Summary|[4.2 Regression] placement |[4.0/4.1/4.2 Regression]
|new does not change the |placement new does not
|dynamic type as it should |change the dynamic type as
| |it should
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29286