From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32765 invoked by alias); 8 May 2012 23:42:00 -0000 Received: (qmail 32757 invoked by uid 22791); 8 May 2012 23:41:59 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 May 2012 23:41:45 +0000 From: "hp at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/53273] test-cases suffer from cross-function optimizations with no way to mark limits Date: Tue, 08 May 2012 23:48:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hp at gcc dot gnu.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: 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-05/txt/msg00945.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53273 --- Comment #2 from Hans-Peter Nilsson 2012-05-08 23:41:41 UTC --- Created attachment 27351 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27351 Like i2.i (attachment 27350) but with main and auxiliary functions, and always aborting This attachment was an edit-in-progress adding functions to make the test-case runnable, but with an error that isn't in gcc.dg/torture/pr53272-2.c: the foobar function always aborts, making the test-case always abort. This leads to different code being generated for the key function rtc_update_irq_enable. The difference seems to be the same as for calling an explicit or computed noreturn function, which would be an ok optimization if cross-function optimization was wanted. Changing the empty line in foobar to "if (foo(x))" as in gcc.dg/torture/pr53272-2.c yields the expected same generated code as for i2.i. So, while it exposes an unwanted optimization, for this case it is benevolent; the goal was add framework to make the case runnable, not aborting. :) Though, I bet I can cook up a C++ case that throws (or C that rethrows) before the aborting call, and the code have the same unwanted difference in presence of the aborting foobar.