public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/5701: Code snippet throwing exception causes internal compiler error
@ 2002-02-15  7:46 spencer
  0 siblings, 0 replies; only message in thread
From: spencer @ 2002-02-15  7:46 UTC (permalink / raw)
  To: gcc-gnats


>Number:         5701
>Category:       c++
>Synopsis:       Code snippet throwing exception causes internal compiler error
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 15 07:46:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Brad Spencer
>Release:        3.0.3
>Organization:
InfoInterActive
>Environment:
System: SunOS starbug 5.6 Generic_105182-05 i86pc i386 i86pc
Architecture: i86pc

	
host: i386-pc-solaris2.6
build: i386-pc-solaris2.6
target: i386-pc-solaris2.6
configured with: ../gcc-3.0.3/configure --prefix=/opt/gcc-3.0.3/ --with-as=/opt/binutils/bin/as --with-ld=/opt/binutils/bin/ld --enable-languages=c,c++ --with-dwarf2 --disable-shared --disable-threads
>Description:
This is an isolated boil-down of a real program I have.  The real program and
this snippet both compile under g++-2.95.3 (configuration of that compiler
shown below).  The snippet is short and includes no other files, so I have
omitted the preprocessed output.

+++ Begin Code:
class Base
{
public:
  Base() {}
  virtual ~Base() {}
};

class MyClass : public Base
{
public:
  class init_error {};
  
public:
  MyClass();
};

MyClass::MyClass()
  : Base()
{
  try {
    int x = 0;
    x++;
  } catch(...) {
    throw init_error();
  }
}
--- End Code

The contents of the try block do not seem to matter.  Moving the definition of
class init_error to global scope does not matter.  Throwing "int" instead of
init_error does cause the code to compile successfully.  Turning off all
optimizations (via "-O"; I didn't try individual flags) also causes the code to
compile successfully.

>How-To-Repeat:
Running gcc-3.0.3 yeilds the following output:
/opt/gcc-3.0.3/bin/g++ -v -c -Wall -O1 -o test.o test.cc
Reading specs from /opt/gcc-3.0.3/bin/../lib/gcc-lib/i386-pc-solaris2.6/3.0.3/specs
Configured with: ../gcc-3.0.3/configure --prefix=/opt/gcc-3.0.3/ --with-as=/opt/binutils/bin/as --with-ld=/opt/binutils/bin/ld --enable-languages=c,c++ --with-dwarf2 --disable-shared --disable-threads
Thread model: single
gcc version 3.0.3
 /opt/gcc-3.0.3/bin/../lib/gcc-lib/i386-pc-solaris2.6/3.0.3/cc1plus -v -iprefix /opt/gcc-3.0.3/bin/../lib/gcc-lib/i386-pc-solaris2.6/3.0.3/ -D__GNUC__=3 -D__GNUC_MINOR__=0 -D__GNUC_PATCHLEVEL__=3 -Dunix -D__svr4__ -D__SVR4 -Dsun -D__unix__ -D__svr4__ -D__SVR4 -D__sun__ -D__unix -D__sun -Asystem=svr4 -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -Wall -D_XOPEN_SOURCE=500 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D__EXTENSIONS__ -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i386__ test.cc -D__GNUG__=3 -D__GXX_DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpbase test.cc -O1 -Wall -version -o /var/tmp/ccjthYx1.s
GNU CPP version 3.0.3 (cpplib) (i386 System V Release 4)
GNU C++ version 3.0.3 (i386-pc-solaris2.6)
        compiled by GNU C version 3.0.3.
ignoring nonexistent directory "/opt/gcc-3.0.3/i386-pc-solaris2.6/include"
ignoring nonexistent directory "/opt/gcc-3.0.3/i386-pc-solaris2.6/include"
ignoring duplicate directory "/opt/gcc-3.0.3/include/g++-v3"
ignoring duplicate directory "/opt/gcc-3.0.3/include/g++-v3/i386-pc-solaris2.6"
ignoring duplicate directory "/opt/gcc-3.0.3/include/g++-v3/backward"
ignoring duplicate directory "/opt/gcc-3.0.3/lib/gcc-lib/i386-pc-solaris2.6/3.0.3/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/gcc-3.0.3/include/g++-v3
 /opt/gcc-3.0.3/include/g++-v3/i386-pc-solaris2.6
 /opt/gcc-3.0.3/include/g++-v3/backward
 /opt/gcc-3.0.3/lib/gcc-lib/i386-pc-solaris2.6/3.0.3/include
 /usr/local/include
 /usr/include
End of search list.
test.cc: In constructor `MyClass::MyClass()':
test.cc:26: Internal compiler error in reachable_next_level, at except.c:2725
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Running against gcc-2.95.3 yeilds success, however:

/opt/gcc-2.95.3/bin/g++ -v -c -Wall -O1 -o test.o test.cc
Reading specs from /opt/gcc-2.95.3/lib/gcc-lib/i386-pc-solaris2.6/2.95.3/specs
gcc version 2.95.3 20010315 (release)
 /opt/gcc-2.95.3/lib/gcc-lib/i386-pc-solaris2.6/2.95.3/cpp0 -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dunix -D__svr4__ -D__SVR4 -Dsun -D__unix__ -D__svr4__ -D__SVR4 -D__sun__ -D__unix -D__sun -Asystem(svr4) -D__EXCEPTIONS -D__OPTIMIZE__ -Wall -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ test.cc /var/tmp/cccejavk.ii
GNU CPP version 2.95.3 20010315 (release) (i386 System V Release 4)
#include "..." search starts here:
#include <...> search starts here:
 /opt/gcc-2.95.3/lib/gcc-lib/i386-pc-solaris2.6/2.95.3/../../../../include/g++-3
 /usr/local/include
 /opt/gcc-2.95.3/lib/gcc-lib/i386-pc-solaris2.6/2.95.3/../../../../i386-pc-solaris2.6/include
 /opt/gcc-2.95.3/lib/gcc-lib/i386-pc-solaris2.6/2.95.3/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /opt/gcc-2.95.3/lib/gcc-lib/i386-pc-solaris2.6/2.95.3/cc1plus /var/tmp/cccejavk.ii -quiet -dumpbase test.cc -O1 -Wall -version -o /var/tmp/ccCk7Hhu.s
GNU C++ version 2.95.3 20010315 (release) (i386-pc-solaris2.6) compiled by GNU C version 2.95.3 20010315 (release).
 /opt/gnu/bin/gas -V -Qy -o test.o /var/tmp/ccCk7Hhu.s
GNU assembler version 2.9.1 (i386-pc-solaris2.6), using BFD version 2.9.1

>Fix:
Unknown.
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-02-15 15:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-15  7:46 c++/5701: Code snippet throwing exception causes internal compiler error spencer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).