This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15795] No way to teach operator new anything about alignment requirements
- From: "ma1flfs at bath dot ac dot uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Jun 2004 18:45:04 -0000
- Subject: [Bug c++/15795] No way to teach operator new anything about alignment requirements
- References: <20040603143635.15795.ma1flfs@bath.ac.uk>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From ma1flfs at bath dot ac dot uk 2004-06-08 18:45 -------
Well, the workaround is a good idea in general, however, this program still
segfaults...
#define _XOPEN_SOURCE 600
#include <xmmintrin.h>
#include <stdio.h>
#include <stdlib.h>
class Vector4
{
public:
__m128 vec;
Vector4()
{
vec = _mm_setzero_ps();
}
void *operator new (unsigned int s)
{
void *p;
posix_memalign(&p, 16, s);
return p;
}
void *operator new[] (unsigned int s)
{
return operator new (s);
}
};
class Foo
{
public:
Vector4 b;
Foo() {}
};
int main(int argc, char **argv)
{
Foo *f = new Foo[200*200];
delete f;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15795