c++/3754: g++ 3.0: failed exception i386 -O -fomit-frame-pointer

Kevin Ryde user42@zip.com.au
Fri Jul 20 16:16:00 GMT 2001


>Number:         3754
>Category:       c++
>Synopsis:       g++ 3.0: failed exception i386 -O -fomit-frame-pointer
>Confidential:   yes
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Fri Jul 20 16:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        3.0 (Debian) (Debian testing/unstable)
>Organization:
>Environment:
System: Linux blah 2.2.15 #1 Tue Apr 25 17:13:48 EST 2000 i586 unknown
Architecture: i586
	<machine, os, target, libraries (multiple lines)>
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux

>Description:
An exception throw fails (with an abort) in a certain program compiled
with -O -fomit-frame-pointer.

>How-To-Repeat:
The program foo.cc below compiled with

        g++-3.0 -O -fomit-frame-pointer foo.cc

ought to print "destroy" and then "caught", but does an abort at some
point after "destroy".  Under gdb "where" gives

        #0  0x40118ae1 in kill () from /lib/libc.so.6
        #1  0x401187c4 in raise () from /lib/libc.so.6
        #2  0x40119f41 in abort () from /lib/libc.so.6
        #3  0x400e8399 in _Unwind_Resume () from /lib/libgcc_s.so.1
        #4  0x804885f in _Z4quuxv ()

For what it's worth, compiling without -O and/or -fomit-frame-pointer
works.


--=-=-=
Content-Type: text/x-c++src
Content-Disposition: attachment; filename=foo.cc


extern "C" int puts (const char *str);

void
foo (void)
{
  throw 1;
}

class bar {
 public:
  int  n;
  bar() { n = 0; }
  ~bar() { puts ("destroy"); }
};

void
quux (void)
{
  bar  x;
  foo ();
}

int
main (int argc, char *argv[])
{
  try {
    quux ();
  }
  catch (...) {
    puts ("caught");
  }

  return 0;
}

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



More information about the Gcc-bugs mailing list