On x86_64 with -O2 the following testcase ICEs with:
D.11907_556(ab) and  D.11907_14(ab)
rh432296.C: In function `void foo(std::vector<B<D>, std::allocator<B<D> > >&)':
rh432296.C:52: internal compiler error: SSA corruption
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

That looks similar to the inlining AB problem Jan fixed, but this is with
current trunk.

Sorry for the left-over #include <vector>, didn't get to minimize this more
yet.
#include <vector>

struct A
{
  A ();
  virtual ~A ();
  inline void incRef ();
  inline void decRef ();
  virtual void free () {}
  int m_refCount;
};
void A::incRef () { m_refCount++; }
void A::decRef () { if (!m_refCount) { free (); return; } m_refCount--; }
template <class T> struct B;
struct C : public A
{
  static C *alloc ();
};
template <class T>
struct B
{
  typedef T DataT;
  B () : ptr (T::alloc ()) { }
  B (const B<T>& a) : ptr (a.get ()) { incRef (); }
  B (T *a_ptr) : ptr (a_ptr) { incRef (); }
  ~B () { decRef (); }
  B& operator= (const B<T>& a) { if (a.get () != this->get ()) { decRef (); ptr
= a.get (); incRef (); } return *this; }
  template<class U>
  operator B<U> () const { return B<U> (ptr); }
  template<class U>
  operator B<const U> () const { return B<const U> (ptr); }
  T* operator-> () const { return ptr; }
  T* get () const { return ptr; }
  void decRef () const { if (ptr != 0) ptr->decRef (); }
  void incRef () const { if (ptr != 0) ptr->incRef (); }
  T *ptr;
};
struct D : public C
{
  template <class T>
  inline void foo (const B<T> & x) { d.resize (1); d[0] = x; }
  std::vector<B <C> > d;
};
struct E : public C
{
  static E *alloc ();
};
struct F : public D
{
  static F *alloc ();
};
void foo (std::vector<B<D> > & x)
{
  for (int i = 0; i < 2; ++i)
    {
      B<F> l;
      B<E> m;
      l->foo (m);
      x.push_back (l);
    }
}


-- 
           Summary: [4.3 regression] Unable to coalesce ab SSA_NAMEs
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org


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

Reply via email to