------- Comment #4 from rguenth at gcc dot gnu dot org  2009-02-02 10:24 -------
Nice testcase from PR38503:

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);
}

we have to assume that any globally accessible decl has a different dynamic
type than its declared type.  Thus we may not apply TBAA to any ESCAPED
symbol.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38964

Reply via email to