http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56840



             Bug #: 56840

           Summary: a.out aborts instead of catching exception with -flto

                    and -static-libstdc++

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: normal

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: w...@trash-mail.com

              Host: CentOS release 6.4 (Final)  x86_64 GNU/Linux

            Target: x86_64-unknown-linux-gnu





Created attachment 29804

  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29804

c++ program to demonstrate misbehavior



$ c++ -v

Using built-in specs.

COLLECT_GCC=c++

COLLECT_LTO_WRAPPER=/usr/local64/gcc-4.8.0/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper

Target: x86_64-unknown-linux-gnu

Configured with: ../gcc-4.8.0/configure --prefix=/usr/local64/gcc-4.8.0

--disable-nls --enable-threads=posix --enable-__cxa_atexit --enable-gold

--with-plugin-ld=ld.gold --enable-languages=c,c++,fortran

--with-arch-32=pentium-mmx

Thread model: posix

gcc version 4.8.0 (GCC)



GNU C (GCC) version 4.8.0 (x86_64-unknown-linux-gnu)

        compiled by GNU C version 4.8.0, GMP version 5.1.1, MPFR version 3.1.2,

MPC version 1.0.1

GNU ld (GNU Binutils) 2.23.1



/**********************************************/

/*********  otto407.c  ************************/

#include <stdio.h>



class MyEx

{

 public:

    MyEx() {}

    virtual ~MyEx() {}

};



int main(void)

{

  try

  {

    throw MyEx();

  }

  catch(MyEx&)

  {

    printf("caught MyEx\n");

  }

  catch(...)

  {

    printf("caught ...\n");

  }



  return 0;

}

/**********************************************/



$ c++ -flto otto407.c -static-libstdc++

$ ./a.out

terminate called after throwing an instance of 'MyEx'

terminate called recursively

Aborted (core dumped)



works as expected when omitting -flto or -static-libstdc++

works as expected with gcc-4.7.2 and gcc-4.5.4

Reply via email to