------- Comment #21 from pluto at agmk dot net 2009-02-27 10:29 -------
(In reply to comment #20)
> Same issue. Only possible fix is to not apply TBAA pruning to escaped
> symbols, which will - well - basically disable TBAA. Testcase:
waht about this testcase?
the bug is marked as fixed but warnings are still present?
> inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; }
>
> struct Y {
> Y() {}
> int i;
> };
>
> struct X {
> X() {}
> void construct(const Y& y)
> {
> new (&m_data[0]) Y(y);
> }
> template <class T>
> Y& get() { return reinterpret_cast<Y&>(m_data); }
> bool initialized;
> char m_data[sizeof (Y)];
> };
>
> X x;
>
> void bar(const X&);
> void foo(Y& y)
> {
> x.get<Y>() = y;
> x.initialized = true;
> bar(x);
> }
>
t.cpp: In member function 'Y& X::get() [with T = Y]':
t.cpp:25: instantiated from here
t.cpp:15: warning: dereferencing type-punned pointer will break strict-aliasing
rules
t.cpp: In function 'void foo(Y&)':
t.cpp:25: warning: dereferencing pointer '<anonymous>' does break
strict-aliasing rules
t.cpp:25: note: initialized from here
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38503