public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/56747] New: throw segfaults on 64bit Cygwin if -O2 (-freorder-blocks) is used with g++ 4.8.0
@ 2013-03-26 19:50 franke at computer dot org
  2013-03-26 20:11 ` [Bug c++/56747] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: franke at computer dot org @ 2013-03-26 19:50 UTC (permalink / raw)
  To: gcc-bugs


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

             Bug #: 56747
           Summary: throw segfaults on 64bit Cygwin if -O2
                    (-freorder-blocks) is used with g++ 4.8.0
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: franke@computer.org


The test program below segfaults during __cxa_throw if -O2 is used. The problem
is possibly related to generation of unwinding-information in conjunction with
-freorder-blocks optimization.

Testcase:

$ uname -srvmo
CYGWIN_NT-6.1 1.7.18(0.263/5/3) 2013-03-26 14:56 x86_64 Cygwin

$ g++ --version
g++ (GCC) 4.8.0

$ cat throw.cc
#include <string>

static int main_worker(int argc)
{
  std::string s[32];
  if (argc < 2)
    throw 42;
  return argc;
}

int main(int argc, char **argv)
{
  try {
    return main_worker(argc);
  }
  catch (int i) {
    return i;
  }
}

$ g++ -O1 -o throw throw.cc

$ ./throw; echo $?
42

$ g++ -O2 -o throw throw.cc

$ ./throw; echo $?
Segmentation fault
139

$ g++ -O2 -fno-reorder-blocks -o throw throw.cc

$ ./throw; echo $?
42

$ g++ -O1 -freorder-blocks -g -o throw throw.cc

$ ./throw; echo $?
Segmentation fault
139

$ gdb throw
...
(gdb) r
Starting program: /tmp/throw/throw
[New Thread 4164.0xe58]
[New Thread 4164.0x7e8]
gdb: unknown target exception 0x20474343 at 0x7fefd7c9e5d
Program received signal ?, Unknown signal.
0x000007fefd7c9e5d in RaiseException () from
/cygdrive/c/Windows/system32/KERNELBASE.dll


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

* [Bug c++/56747] throw segfaults on 64bit Cygwin if -O2 (-freorder-blocks) is used with g++ 4.8.0
  2013-03-26 19:50 [Bug c++/56747] New: throw segfaults on 64bit Cygwin if -O2 (-freorder-blocks) is used with g++ 4.8.0 franke at computer dot org
@ 2013-03-26 20:11 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-03-26 20:11 UTC (permalink / raw)
  To: gcc-bugs


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2013-03-26 20:11:28 UTC ---
Dup of bug 56742.

*** This bug has been marked as a duplicate of bug 56742 ***


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

end of thread, other threads:[~2013-03-26 20:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-26 19:50 [Bug c++/56747] New: throw segfaults on 64bit Cygwin if -O2 (-freorder-blocks) is used with g++ 4.8.0 franke at computer dot org
2013-03-26 20:11 ` [Bug c++/56747] " pinskia 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).