This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c++/9982: placement new returns wrong value
- From: kunert at physik dot tu-dresden dot de
- To: gcc-gnats at gcc dot gnu dot org
- Date: 6 Mar 2003 18:40:29 -0000
- Subject: c++/9982: placement new returns wrong value
- Reply-to: kunert at physik dot tu-dresden dot de
>Number: 9982
>Category: c++
>Synopsis: placement new returns wrong value
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Mar 06 18:46:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: kunert at physik dot tu-dresden dot de
>Release: 3.4 20030304
>Organization:
>Environment:
Reading specs from /opt/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs
Configured with: ../configure --enable-shared --program-suffix= --prefix=/opt --enable-languages=c,c++,f77 --enable-__cxa_atexit
Thread model: posix
gcc version 3.4 20030304 (experimental)
>Description:
#include<iostream>
using namespace std;
struct A {
~A(){}
};
int main()
{
A * a = (A*) new char[20];
A * b = new(a) A[3];
cout << a << ' ' << b << endl;
}
a and b should be identical, but
running this program shows different velues.
3.2.1 has the same bug.
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: