public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56840] New: a.out aborts instead of catching exception with -flto and -static-libstdc++
@ 2013-04-04 14:22 wem@trash-mail.com
  2013-04-04 14:36 ` [Bug c++/56840] " wem@trash-mail.com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: wem@trash-mail.com @ 2013-04-04 14:22 UTC (permalink / raw)
  To: gcc-bugs


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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/56840] a.out aborts instead of catching exception with -flto and -static-libstdc++
  2013-04-04 14:22 [Bug c++/56840] New: a.out aborts instead of catching exception with -flto and -static-libstdc++ wem@trash-mail.com
@ 2013-04-04 14:36 ` wem@trash-mail.com
  2013-04-04 14:39 ` rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: wem@trash-mail.com @ 2013-04-04 14:36 UTC (permalink / raw)
  To: gcc-bugs


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

--- Comment #1 from Werner <wem@trash-mail.com> 2013-04-04 14:36:39 UTC ---
Created attachment 29805
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29805
generated with c++ -save-temps


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c++/56840] a.out aborts instead of catching exception with -flto and -static-libstdc++
  2013-04-04 14:22 [Bug c++/56840] New: a.out aborts instead of catching exception with -flto and -static-libstdc++ wem@trash-mail.com
  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
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu.org @ 2013-04-04 14:39 UTC (permalink / raw)
  To: gcc-bugs


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-04-04
                 CC|                            |iant at google dot com
               Host|CentOS release 6.4 (Final)  |
                   |x86_64 GNU/Linux            |
     Ever Confirmed|0                           |1

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> 2013-04-04 14:39:30 UTC ---
Confirmed with using gold, works when using GNU ld (2.23.1).  This is probably
a linker issue then.

Ian?

gold:

1
t.o 16
165 46dc27f64f5c9b0d PREVAILING_DEF_IRONLY _ZN4MyExD2Ev
185 46dc27f64f5c9b0d PREVAILING_DEF_IRONLY _ZTV4MyEx
237 46dc27f64f5c9b0d PREVAILING_DEF_IRONLY _ZN4MyExD1Ev
246 46dc27f64f5c9b0d PREVAILING_DEF_IRONLY _ZN4MyExD0Ev
255 46dc27f64f5c9b0d PREVAILING_DEF_IRONLY _ZN4MyExC2Ev
261 46dc27f64f5c9b0d PREVAILING_DEF_IRONLY _ZN4MyExC1Ev
266 46dc27f64f5c9b0d PREVAILING_DEF main
209 46dc27f64f5c9b0d PREVAILING_DEF_IRONLY _ZTI4MyEx
232 46dc27f64f5c9b0d PREVAILING_DEF_IRONLY _ZTS4MyEx
269 46dc27f64f5c9b0d RESOLVED_EXEC __gxx_personality_v0
220 46dc27f64f5c9b0d RESOLVED_EXEC _ZTVN10__cxxabiv117__class_type_infoE
276 46dc27f64f5c9b0d RESOLVED_EXEC _ZdlPv
283 46dc27f64f5c9b0d RESOLVED_EXEC __cxa_end_catch
287 46dc27f64f5c9b0d RESOLVED_EXEC __cxa_begin_catch
293 46dc27f64f5c9b0d RESOLVED_EXEC __cxa_throw
301 46dc27f64f5c9b0d RESOLVED_EXEC __cxa_allocate_exception

bfd:

1
t.o 16
165 4ce296565b57ee97 PREVAILING_DEF_IRONLY _ZN4MyExD2Ev
185 4ce296565b57ee97 PREVAILING_DEF_IRONLY _ZTV4MyEx
237 4ce296565b57ee97 PREVAILING_DEF_IRONLY _ZN4MyExD1Ev
246 4ce296565b57ee97 PREVAILING_DEF_IRONLY _ZN4MyExD0Ev
255 4ce296565b57ee97 PREVAILING_DEF_IRONLY _ZN4MyExC2Ev
261 4ce296565b57ee97 PREVAILING_DEF_IRONLY _ZN4MyExC1Ev
266 4ce296565b57ee97 PREVAILING_DEF main
209 4ce296565b57ee97 PREVAILING_DEF_IRONLY _ZTI4MyEx
232 4ce296565b57ee97 PREVAILING_DEF_IRONLY _ZTS4MyEx
269 4ce296565b57ee97 RESOLVED_EXEC __gxx_personality_v0
220 4ce296565b57ee97 RESOLVED_EXEC _ZTVN10__cxxabiv117__class_type_infoE
276 4ce296565b57ee97 RESOLVED_EXEC _ZdlPv
283 4ce296565b57ee97 RESOLVED_EXEC __cxa_end_catch
287 4ce296565b57ee97 RESOLVED_EXEC __cxa_begin_catch
293 4ce296565b57ee97 RESOLVED_EXEC __cxa_throw
301 4ce296565b57ee97 RESOLVED_EXEC __cxa_allocate_exception

so we probably produce the same LTRANS units for the same link.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/56840] a.out aborts instead of catching exception with -flto and -static-libstdc++
  2013-04-04 14:22 [Bug c++/56840] New: a.out aborts instead of catching exception with -flto and -static-libstdc++ wem@trash-mail.com
  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 ` ian at airs dot com
  2022-08-01 17:36 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ian at airs dot com @ 2013-04-04 16:52 UTC (permalink / raw)
  To: gcc-bugs


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

Ian Lance Taylor <ian at airs dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ian at airs dot com
         Resolution|                            |FIXED

--- Comment #3 from Ian Lance Taylor <ian at airs dot com> 2013-04-04 16:52:35 UTC ---
Yes, it's a bug in gold in the handling of .eh_frame sections in archives when
using a plugin.  I just committed a patch to gold:
http://sourceware.org/ml/binutils/2013-04/msg00026.html .  Unfortunately this
patch probably won't be in a released version of the GNU binutils for a while.

I don't know why this worked with GCC 4.7.  I haven't looked into it.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug lto/56840] a.out aborts instead of catching exception with -flto and -static-libstdc++
  2013-04-04 14:22 [Bug c++/56840] New: a.out aborts instead of catching exception with -flto and -static-libstdc++ wem@trash-mail.com
                   ` (2 preceding siblings ...)
  2013-04-04 16:52 ` [Bug lto/56840] " ian at airs dot com
@ 2022-08-01 17:36 ` redi at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2022-08-01 17:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jason Merrill from comment #4)
> Author: jason
> Date: Sun Nov 13 06:51:23 2016
> New Revision: 242348
> 
> URL: https://gcc.gnu.org/viewcvs?rev=242348&root=gcc&view=rev
> Log:
> 	DR 374 - specialization in outer namespace
> 
> 	PR c++/56840

For the record, that commit fixed PR c++/56480 not this one.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-01 17:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 14:22 [Bug c++/56840] New: a.out aborts instead of catching exception with -flto and -static-libstdc++ wem@trash-mail.com
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

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).