This is the mail archive of the gcc-patches@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]

Re: [PATCH] Fix C++ strict-aliasing issues with memcpy folding


Hi,

On Tue, 2 Feb 2010, Gabriel Dos Reis wrote:

> > If other POD types are supposed to be fine then you probably share
> > Marks view of disallowing in-place construction of arbitrary
> > types in arbitrary storage with a declared type? ÂThus only
> > allow it to be constructed in place of a union, supposedly with
> > a char[] member?
> 
> Yes, that is my view.

Just to be crystal clear: if that storage was anonymous, do you agree that 
we can construct arbitrary types into it?  I.e. is the following valid in 
C++? :

struct X { int mem[2]; } *p, *q;
float *f;
p = new X; q = new X;
f = new (&p->mem[0]) float;
*f = 1.0;
*q = *p;

(incidentally it's interesting to think about what type the access '*p' 
has)


Ciao,
Michael.

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