public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wem@trash-mail.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/56840] New: a.out aborts instead of catching exception with -flto and -static-libstdc++
Date: Thu, 04 Apr 2013 14:22:00 -0000	[thread overview]
Message-ID: <bug-56840-4@http.gcc.gnu.org/bugzilla/> (raw)


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: unassigned@gcc.gnu.org
        ReportedBy: wem@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	other threads:[~2013-04-04 14:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-04 14:22 wem@trash-mail.com [this message]
2013-04-04 14:36 ` [Bug c++/56840] " wem@trash-mail.com
2013-04-04 14:39 ` rguenth at gcc dot gnu.org
2013-04-04 16:52 ` [Bug lto/56840] " ian at airs dot com
2022-08-01 17:36 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-56840-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).