From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14402 invoked by alias); 16 Apr 2013 14:31:16 -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 14376 invoked by uid 48); 16 Apr 2013 14:31:12 -0000 From: "jdemeyer at cage dot ugent.be" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/56982] New: Bad optimization with setjmp() Date: Tue, 16 Apr 2013 14:31:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jdemeyer at cage dot ugent.be 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-04/txt/msg01539.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56982 Bug #: 56982 Summary: Bad optimization with setjmp() Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned@gcc.gnu.org ReportedBy: jdemeyer@cage.ugent.be Target: x86_64-pc-linux-gnu Created attachment 29883 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29883 Bug program Compile the example program with gcc -Og jmp.c -o jmp Run the program ./jmp and the output is Returning 1 x = 0, n = 1 Returning 0 x = 42, n = 1 Aborted The function g() is returning 0 the second time (after longjmp()) but the return value, assigned to n, equals 1. With other optimization levels or with earlier versions of gcc or with -Og -fno-tree-dominator-opts, the output is what I expect: Returning 1 x = 0, n = 1 Returning 0 x = 42, n = 0 This is with gcc version 4.8.0, GNU libc version 2.15.