OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.dg/] [opt/] [pr6713.C] - Diff between revs 301 and 338

Only display areas with differences | Details | Blame | View Log

Rev 301 Rev 338
// PR optimization/6713
// PR optimization/6713
// This testcase segfaulted on x86 because a dangling REG_EQUAL note
// This testcase segfaulted on x86 because a dangling REG_EQUAL note
// resulted in incorrect substitutions later.
// resulted in incorrect substitutions later.
// { dg-do run }
// { dg-do run }
// { dg-options "-O2" }
// { dg-options "-O2" }
template class basic_iterator
template class basic_iterator
{
{
  public:
  public:
    basic_iterator(_CharT* _p) : _M_current(_p) {}
    basic_iterator(_CharT* _p) : _M_current(_p) {}
    basic_iterator& operator++() { ++_M_current; return *this; }
    basic_iterator& operator++() { ++_M_current; return *this; }
    _CharT& operator*() const { return *_M_current; }
    _CharT& operator*() const { return *_M_current; }
    bool operator!=(basic_iterator &_rhs) { return _M_current != _rhs._M_current; }
    bool operator!=(basic_iterator &_rhs) { return _M_current != _rhs._M_current; }
  private:
  private:
    _CharT* _M_current;
    _CharT* _M_current;
};
};
template class basic_string
template class basic_string
{
{
  public:
  public:
    typedef unsigned int size_type;
    typedef unsigned int size_type;
    typedef basic_iterator<_CharT> iterator;
    typedef basic_iterator<_CharT> iterator;
  private:
  private:
    struct _Rep
    struct _Rep
    {
    {
      size_type _M_length;
      size_type _M_length;
      size_type _M_capacity;
      size_type _M_capacity;
      int _M_references;
      int _M_references;
      bool _M_is_leaked() const { return _M_references < 0; }
      bool _M_is_leaked() const { return _M_references < 0; }
      bool _M_is_shared() const { return _M_references > 0; }
      bool _M_is_shared() const { return _M_references > 0; }
      void _M_set_leaked() { _M_references = -1; }
      void _M_set_leaked() { _M_references = -1; }
      void _M_set_sharable() { _M_references = 0; }
      void _M_set_sharable() { _M_references = 0; }
    };
    };
    struct _Rep _M_rep;
    struct _Rep _M_rep;
    struct _Alloc_hider
    struct _Alloc_hider
    {
    {
      _CharT _raw[16];
      _CharT _raw[16];
      _CharT* _M_p;
      _CharT* _M_p;
    };
    };
    mutable _Alloc_hider _M_dataplus;
    mutable _Alloc_hider _M_dataplus;
    _CharT* _M_data() const { return _M_dataplus._M_p; }
    _CharT* _M_data() const { return _M_dataplus._M_p; }
    void _M_leak() { if (!_M_rep._M_is_leaked()) _M_leak_hard(); }
    void _M_leak() { if (!_M_rep._M_is_leaked()) _M_leak_hard(); }
    static int count;
    static int count;
    static void _M_leak_hard();
    static void _M_leak_hard();
  public:
  public:
    explicit basic_string(const _CharT* __s);
    explicit basic_string(const _CharT* __s);
    iterator begin() { _M_leak(); return iterator(_M_data()); }
    iterator begin() { _M_leak(); return iterator(_M_data()); }
    iterator end() { _M_leak(); return iterator(_M_data() + this->size()); }
    iterator end() { _M_leak(); return iterator(_M_data() + this->size()); }
    size_type size() const { return _M_rep._M_length; }
    size_type size() const { return _M_rep._M_length; }
};
};
template basic_string<_CharT>::
template basic_string<_CharT>::
basic_string(const _CharT* __s)
basic_string(const _CharT* __s)
{
{
  int i;
  int i;
  for (i=0; i<15; i++) {
  for (i=0; i<15; i++) {
    if (!__s[i])
    if (!__s[i])
      break;
      break;
    _M_dataplus._raw[i] = __s[i];
    _M_dataplus._raw[i] = __s[i];
  }
  }
  _M_dataplus._raw[i] = 0;
  _M_dataplus._raw[i] = 0;
  _M_dataplus._M_p = _M_dataplus._raw;
  _M_dataplus._M_p = _M_dataplus._raw;
  _M_rep._M_length = i;
  _M_rep._M_length = i;
  _M_rep._M_capacity = i;
  _M_rep._M_capacity = i;
  _M_rep._M_references = 1;
  _M_rep._M_references = 1;
}
}
template int basic_string<_CharT>::count = 0;
template int basic_string<_CharT>::count = 0;
template void basic_string<_CharT>::
template void basic_string<_CharT>::
_M_leak_hard()
_M_leak_hard()
{
{
  count++;
  count++;
}
}
typedef basic_string string;
typedef basic_string string;
template int basic_string::count;
template int basic_string::count;
int isspa(int ch)
int isspa(int ch)
{
{
  return 0;
  return 0;
}
}
void foo(string& str)
void foo(string& str)
{
{
  string::iterator it = str.begin();
  string::iterator it = str.begin();
  string::iterator stop = str.end();
  string::iterator stop = str.end();
  for (; it != stop; ++it)
  for (; it != stop; ++it)
    if (isspa(*it))
    if (isspa(*it))
      break;
      break;
}
}
int main()
int main()
{
{
  string str("test");
  string str("test");
  foo(str);
  foo(str);
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.