This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c++/1784: Internal error: Segmentation Fault when optimizing



>Number:         1784
>Category:       c++
>Synopsis:       Internal error: Segmentation Fault when optimizing
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 26 10:16:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Hyman Rosen
>Release:        gcc version 2.97 20010124 (experimental)
>Organization:
>Environment:
Compile with 'g++ -O3'.
>Description:
The following code makes the compiler segfault when compiled with -O3.

template <class T> class Q;
template <class T> struct N { };
template <class T> struct QI { QI (Q<T> &, int = 0); N<T> *c; Q<T> &q; };
template <class T> struct Q { QI<T> e (); };
template <class T> QI<T> Q<T>::e () { return QI<T> (*this, 1); }
template <class T> QI<T>::QI (Q<T> &q, int) : q(q) { }
struct V { int c (void); unsigned a; char *b; unsigned l; Q<char *> q; };
int
V::c (void)
{
                                               ;
  if (a <= 0) return -1;
  delete [] b;
  try { b = new char[l + a]; }
  catch (...) { }
  QI<char *> iter (q);
  char **arg;
  char *ptr = b;
  unsigned len;
  int more = 0;
  *ptr = '\0';
  return 0;
}
template class Q<char *>;
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]