From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2767 invoked by alias); 26 Mar 2013 19:50:54 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 2729 invoked by uid 48); 26 Mar 2013 19:50:48 -0000 From: "franke at computer dot org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56747] New: throw segfaults on 64bit Cygwin if -O2 (-freorder-blocks) is used with g++ 4.8.0 Date: Tue, 26 Mar 2013 19:50:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: franke at computer dot org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 X-SW-Source: 2013-03/txt/msg01942.txt.bz2 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 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