public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32
@ 2011-11-15  5:21 gurnec-bugz at gis dot net
  2011-12-05 14:14 ` [Bug libstdc++/51135] [4.7 Regression] " rguenth at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: gurnec-bugz at gis dot net @ 2011-11-15  5:21 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51135
           Summary: SIGSEGV during exception cleanup on win32
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gurnec-bugz@gis.net


It looks like __thiscall is now the default calling convention for member
functions (where possible) for win32 targets. This seems to have broken
exception cleanup. 

This seg faults when executed (and compiled by mingw-32):

===============
struct except {
  virtual ~except() {}
};

int main() {
  try {
    throw except();
  } catch(except) {
  }
}
===============

The seg fault occurs after the catch block is exited, and except::~except() is
called by the runtime. I think __gxx_exception_cleanup (in
libstdc++-v3/libsupc++/eh_throw.cc) is still trying to call except::~except()
using the old calling convention, resulting in a seg fault on any access to
'this'.

-Chris


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

* [Bug libstdc++/51135] [4.7 Regression] SIGSEGV during exception cleanup on win32
  2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
@ 2011-12-05 14:14 ` rguenth at gcc dot gnu.org
  2011-12-05 14:53 ` paolo.carlini at oracle dot com
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-05 14:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.7.0


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

* [Bug libstdc++/51135] [4.7 Regression] SIGSEGV during exception cleanup on win32
  2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
  2011-12-05 14:14 ` [Bug libstdc++/51135] [4.7 Regression] " rguenth at gcc dot gnu.org
@ 2011-12-05 14:53 ` paolo.carlini at oracle dot com
  2011-12-05 15:11 ` davek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-05 14:53 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cgf at gcc dot gnu.org,
                   |                            |dave.korn.cygwin at gmail
                   |                            |dot com, ktietz at gcc dot
                   |                            |gnu.org

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-12-05 14:52:58 UTC ---
This badly requires a target maintainer.


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

* [Bug libstdc++/51135] [4.7 Regression] SIGSEGV during exception cleanup on win32
  2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
  2011-12-05 14:14 ` [Bug libstdc++/51135] [4.7 Regression] " rguenth at gcc dot gnu.org
  2011-12-05 14:53 ` paolo.carlini at oracle dot com
@ 2011-12-05 15:11 ` davek at gcc dot gnu.org
  2011-12-05 15:18 ` ktietz at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: davek at gcc dot gnu.org @ 2011-12-05 15:11 UTC (permalink / raw)
  To: gcc-bugs

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

Dave Korn <davek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |davek at gcc dot gnu.org

--- Comment #2 from Dave Korn <davek at gcc dot gnu.org> 2011-12-05 15:10:54 UTC ---
Doesn't reproduce on Cygwin, and I don't have a current mingw cross compiler
handy.  It would be best if Kai can look at this as I'm up to my neck in ada at
the moment, if he hasn't found time in the next four or five days I'll try and
investigate.


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

* [Bug libstdc++/51135] [4.7 Regression] SIGSEGV during exception cleanup on win32
  2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
                   ` (2 preceding siblings ...)
  2011-12-05 15:11 ` davek at gcc dot gnu.org
@ 2011-12-05 15:18 ` ktietz at gcc dot gnu.org
  2011-12-06 14:05 ` [Bug target/51135] " rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ktietz at gcc dot gnu.org @ 2011-12-05 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-12-05
     Ever Confirmed|0                           |1

--- Comment #3 from Kai Tietz <ktietz at gcc dot gnu.org> 2011-12-05 15:17:34 UTC ---
Well, this seems to be caused by member exceptionDestructor in __cxa_exception
structure.  As a destructor has also __thiscall convention, we need to specify
it here for 32-bit Windows target.

I am just about to test a patch for it.


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

* [Bug target/51135] [4.7 Regression] SIGSEGV during exception cleanup on win32
  2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
                   ` (3 preceding siblings ...)
  2011-12-05 15:18 ` ktietz at gcc dot gnu.org
@ 2011-12-06 14:05 ` rguenth at gcc dot gnu.org
  2011-12-12 13:31 ` ktietz at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-12-06 14:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |mingw32
           Priority|P3                          |P1
          Component|libstdc++                   |target


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

* [Bug target/51135] [4.7 Regression] SIGSEGV during exception cleanup on win32
  2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
                   ` (4 preceding siblings ...)
  2011-12-06 14:05 ` [Bug target/51135] " rguenth at gcc dot gnu.org
@ 2011-12-12 13:31 ` ktietz at gcc dot gnu.org
  2011-12-12 13:39 ` ktietz at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ktietz at gcc dot gnu.org @ 2011-12-12 13:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Kai Tietz <ktietz at gcc dot gnu.org> 2011-12-12 13:29:14 UTC ---
Author: ktietz
Date: Mon Dec 12 13:29:10 2011
New Revision: 182238

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182238
Log:
Correct bug-number in ChangeLog.

        PR libstdc++/51135
        * libsupc++/cxxabi.h (__cxxabi_dtor_type): New type.
        (__cxa_throw): Use it for destructor-argument.
        * libsupc++/eh_throw.cc (__cxa_throw): Likewise.
        * libsupc++/unwind-cxx.h (__cxa_exception): Change type of member
        exceptionDestructor to __cxxabi_dtor_type.
        * config/os/mingw32-w64/os_defines.h (_GLIBCXX_USE_THISCALL_ON_DTOR):
        Define.
        (__cxa_dtor_type): Declare target secific type variant.
        * config/os/mingw32/os_defines.h: Likewise.

Modified:
    trunk/libstdc++-v3/ChangeLog


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

* [Bug target/51135] [4.7 Regression] SIGSEGV during exception cleanup on win32
  2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
                   ` (5 preceding siblings ...)
  2011-12-12 13:31 ` ktietz at gcc dot gnu.org
@ 2011-12-12 13:39 ` ktietz at gcc dot gnu.org
  2011-12-12 17:35 ` paolo at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ktietz at gcc dot gnu.org @ 2011-12-12 13:39 UTC (permalink / raw)
  To: gcc-bugs

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Kai Tietz <ktietz at gcc dot gnu.org> 2011-12-12 13:31:16 UTC ---
Fixed at revision 182237.


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

* [Bug target/51135] [4.7 Regression] SIGSEGV during exception cleanup on win32
  2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
                   ` (6 preceding siblings ...)
  2011-12-12 13:39 ` ktietz at gcc dot gnu.org
@ 2011-12-12 17:35 ` paolo at gcc dot gnu.org
  2011-12-12 18:10 ` paolo.carlini at oracle dot com
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: paolo at gcc dot gnu.org @ 2011-12-12 17:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from paolo at gcc dot gnu.org <paolo at gcc dot gnu.org> 2011-12-12 17:34:24 UTC ---
Author: paolo
Date: Mon Dec 12 17:34:19 2011
New Revision: 182250

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182250
Log:
2011-12-12  Paolo Carlini  <paolo.carlini@oracle.com>

    Revert:
    2011-12-12  Kai Tietz  <ktietz@redhat.com>

    PR libstdc++/51135
    * libsupc++/cxxabi.h (__cxa_dtor_type): New type.
    (__cxa_throw): Use it for destructor-argument.
    * libsupc++/eh_throw.cc (__cxa_throw): Likewise.
    * libsupc++/unwind-cxx.h (__cxa_exception): Change type of member
    exceptionDestructor to __cxa_dtor_type.
    * config/os/mingw32-w64/os_defines.h (_GLIBCXX_USE_THISCALL_ON_DTOR):
    Define.
    (__cxa_dtor_type): Declare target secific type variant.
    * config/os/mingw32/os_defines.h: Likewise.

Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/config/os/mingw32-w64/os_defines.h
    trunk/libstdc++-v3/config/os/mingw32/os_defines.h
    trunk/libstdc++-v3/libsupc++/cxxabi.h
    trunk/libstdc++-v3/libsupc++/eh_throw.cc
    trunk/libstdc++-v3/libsupc++/unwind-cxx.h


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

* [Bug target/51135] [4.7 Regression] SIGSEGV during exception cleanup on win32
  2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
                   ` (7 preceding siblings ...)
  2011-12-12 17:35 ` paolo at gcc dot gnu.org
@ 2011-12-12 18:10 ` paolo.carlini at oracle dot com
  2011-12-16 18:47 ` ktietz at gcc dot gnu.org
  2011-12-16 18:58 ` ktietz at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-12-12 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

--- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-12-12 17:38:08 UTC ---
Patch reverted.


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

* [Bug target/51135] [4.7 Regression] SIGSEGV during exception cleanup on win32
  2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
                   ` (8 preceding siblings ...)
  2011-12-12 18:10 ` paolo.carlini at oracle dot com
@ 2011-12-16 18:47 ` ktietz at gcc dot gnu.org
  2011-12-16 18:58 ` ktietz at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: ktietz at gcc dot gnu.org @ 2011-12-16 18:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Kai Tietz <ktietz at gcc dot gnu.org> 2011-12-16 18:43:11 UTC ---
Author: ktietz
Date: Fri Dec 16 18:43:06 2011
New Revision: 182410

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182410
Log:
        PR libstdc++/51135
        * libsupc++/unwind-cxx.h (__cxa_exception): Mark
        exceptionDestructor by _GLIBCXX_CDTOR_CALLABI.
        * libsupc++/eh_throw.cc (__cxa_throw): Mark destructor
        function argument by _GLIBCXX_CDTOR_CALLABI.
        * libsupc++/cxxabi.h (__cxa_throw): Likewise.
        (_GLIBCXX_CDTOR_CALLABI): Add empty default
        definition.
        * config/os/mingw32-w64/os_defines.h (_GLIBCXX_CDTOR_CALLABI): Define
        for IA-32 target as __thiscall.
        * config/os/mingw32/os_defines.h (_GLIBCXX_CDTOR_CALLABI): Likewise.


Modified:
    trunk/libstdc++-v3/config/os/mingw32-w64/os_defines.h
    trunk/libstdc++-v3/config/os/mingw32/os_defines.h
    trunk/libstdc++-v3/libsupc++/cxxabi.h
    trunk/libstdc++-v3/libsupc++/eh_throw.cc
    trunk/libstdc++-v3/libsupc++/unwind-cxx.h


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

* [Bug target/51135] [4.7 Regression] SIGSEGV during exception cleanup on win32
  2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
                   ` (9 preceding siblings ...)
  2011-12-16 18:47 ` ktietz at gcc dot gnu.org
@ 2011-12-16 18:58 ` ktietz at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: ktietz at gcc dot gnu.org @ 2011-12-16 18:58 UTC (permalink / raw)
  To: gcc-bugs

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

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |FIXED

--- Comment #9 from Kai Tietz <ktietz at gcc dot gnu.org> 2011-12-16 18:46:36 UTC ---
Fixed at revision 182410.


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

end of thread, other threads:[~2011-12-16 18:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-15  5:21 [Bug libstdc++/51135] New: SIGSEGV during exception cleanup on win32 gurnec-bugz at gis dot net
2011-12-05 14:14 ` [Bug libstdc++/51135] [4.7 Regression] " rguenth at gcc dot gnu.org
2011-12-05 14:53 ` paolo.carlini at oracle dot com
2011-12-05 15:11 ` davek at gcc dot gnu.org
2011-12-05 15:18 ` ktietz at gcc dot gnu.org
2011-12-06 14:05 ` [Bug target/51135] " rguenth at gcc dot gnu.org
2011-12-12 13:31 ` ktietz at gcc dot gnu.org
2011-12-12 13:39 ` ktietz at gcc dot gnu.org
2011-12-12 17:35 ` paolo at gcc dot gnu.org
2011-12-12 18:10 ` paolo.carlini at oracle dot com
2011-12-16 18:47 ` ktietz at gcc dot gnu.org
2011-12-16 18:58 ` ktietz 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).