ICE in flow.c:verify_local_live_at_start

scott snyder snyder@fnal.gov
Mon Apr 3 17:35:00 GMT 2000


hi -

For a recent cvs version of g++ (2.96 20000402 on i686-pc-linux-gnu),
the following input gets an ICE if -O2 is used:

---------------------------------------------------------------
struct A { };

class const_iterator
  : public A
{
public:
  const_iterator() {}
  int x;
};

void* foo_allocate();
void foo_deallocate(int n);

void destroy (A*);

void
__uninitialized_copy_aux(const_iterator __first, const_iterator __last,
                         A* __result);


inline void
  uninitialized_copy(const_iterator __first, const_iterator __last,
                     A* __result)
{
  __uninitialized_copy_aux(__first, __last, __result);
}

class vector
{

public:
  A* _M_start;
  A* _M_finish;

  vector& operator=(const vector& __x);

  void _M_deallocate (A* __p, int __n)
  { if (0 != __n) foo_deallocate(0); }
protected:

  A* _M_allocate_and_copy(int __n, const_iterator __first, 
                               const_iterator __last)
{
  A* __result = (0 == __n ? 0 : (A*) foo_allocate());
    try
      {
        uninitialized_copy(__first, __last, __result);
      return __result;
    }
    catch (...) {_M_deallocate(__result, __n); throw; }
  }
};


vector& 
vector::operator=(const vector& __x)
{
  if (&__x != this) {
    const int __xlen = __x._M_finish - __x._M_start;
    {
      A* __tmp = _M_allocate_and_copy(__xlen, const_iterator (),
                                      const_iterator ());
      destroy(_M_start);
      _M_deallocate(_M_start, _M_finish - _M_start);
      _M_start = __tmp;
    }
    _M_finish = _M_start;
  }
  return *this;
}
---------------------------------------------------------------


$ ./cc1plus -O2 x.cc
vector &vector::operator= (const vector &)
x.cc:70: Internal compiler error in `verify_local_live_at_start', at
x.cc:70: flow.c:2633
x.cc:70: Please submit a full bug report.
x.cc:70: See <URL: http://www.gnu.org/software/gcc/bugs.html > for
x.cc:70: instructions.


thanks,
sss


More information about the Gcc-bugs mailing list