Re: Help understanding gcc alias analysis

2009-01-12 Thread Raoul Gough
Richard Guenther wrote: On Mon, Jan 12, 2009 at 12:03 AM, Raoul Gough wrote: Richard Guenther wrote: [snip] This is also invalid. You have to use placement new to change the dynamic type of memory. Yes, I guess that makes sense. I've modified the example like

Re: Help understanding gcc alias analysis

2009-01-11 Thread Raoul Gough
Richard Guenther wrote: On Sun, Jan 11, 2009 at 7:59 PM, Raoul Gough wrote: [snip] I guess the situation is more complicated in C++, which has explicit destructors. Consider the following example, which is getting closer to the problem that originally got me interested in this subject

Re: Help understanding gcc alias analysis

2009-01-11 Thread Raoul Gough
Richard Guenther wrote: On Sat, Jan 10, 2009 at 12:55 PM, Richard Guenther wrote: On Sat, Jan 10, 2009 at 12:19 PM, Raoul Gough wrote: [snip] Here we pass into bar a pointer to int and double at the same storage location. So now, if the compiler goes ahead and reorders the read and

Help understanding gcc alias analysis

2009-01-10 Thread Raoul Gough
ent type. However, this re-use takes place within function bar, which doesn't necessarily know about the union (especially if it's in a different compilation unit). So, my question is, does the salias analysis indicate that the compiler thinks it can reorder the operations in function