From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29413 invoked by alias); 15 Nov 2012 11:28:49 -0000 Received: (qmail 29354 invoked by uid 48); 15 Nov 2012 11:28:33 -0000 From: "anton.katilin at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/55339] Generated code hangs with -O2 on Linux ppc Date: Thu, 15 Nov 2012 11:28:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: anton.katilin at gmail dot com 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: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2012-11/txt/msg01394.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55339 --- Comment #1 from anton.katilin at gmail dot com 2012-11-15 11:28:32 UTC --- Compile with: ------------------------------------- export PATH=/opt/gcc-4.7.2/bin:$PATH g++ -m32 -fPIC -O2 *.cpp -o test-O2.bin g++ -m32 -fPIC -O1 *.cpp -o test-O1.bin Please find the source code of the test below. ------------------------------------- Test.cpp ------------------------------------- #include #include "Foo.h" int main() { try { printf("entering...\n"); fflush(stdout); YS(-1); // will throw exception printf("must never reach\n"); } catch (int) { printf("exception caught, as expected\n"); } printf("OK\n"); return 0; } ------------------------------------- Foo.h ------------------------------------- #pragma once void foo(); void checkPositive(int); class YS { public: YS(int capacity) { checkPositive(capacity); } ~YS() { foo(); } }; void throwException(const YS&); ------------------------------------- Foo.cpp ------------------------------------- #include "Foo.h" void foo() { } void checkPositive(int v) { if (v <= 0) { throwException(10); } } void throwException(const YS&) { throw int(1); }