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]

c++/9982: placement new returns wrong value


>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:


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