From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21971 invoked by alias); 14 Feb 2014 18:39:42 -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 21937 invoked by uid 48); 14 Feb 2014 18:39:39 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/60175] ICE on gcc.dg/asan/nosanitize-and-inline.c Date: Fri, 14 Feb 2014 18:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-02/txt/msg01351.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60175 --- Comment #9 from Jakub Jelinek --- --- gcc/function.c.jj 2014-01-06 22:32:17.000000000 +0100 +++ gcc/function.c 2014-02-14 19:05:27.233008179 +0100 @@ -5156,17 +5156,20 @@ expand_function_end (void) crtl->return_rtx = outgoing; } - /* Emit the actual code to clobber return register. */ - { - rtx seq; + /* Emit the actual code to clobber return register. Don't emit + it if clobber_after is a barrier, then the previous basic block + certainly doesn't fall thru into the exit block. */ + if (!BARRIER_P (clobber_after)) + { + rtx seq; - start_sequence (); - clobber_return_register (); - seq = get_insns (); - end_sequence (); + start_sequence (); + clobber_return_register (); + seq = get_insns (); + end_sequence (); - emit_insn_after (seq, clobber_after); - } + emit_insn_after (seq, clobber_after); + } /* Output the label for the naked return from the function. */ if (naked_return_label) fixes this for the common case of not falling through into the exit block, if clobber_after is BARRIER, the clobbers will surely be never reachable and immediately removed anyway. Now, even with this patch we generate incorrect frequencies say for -O2 -fsanitize=address on: int foo (int i) { if (i) return 4; int j; bar (&j); } I think in that case we either need to stick the clobber stmts before the return_label into the predecessor basic block, or create a new basic block to hold just the clobbers and derive the frequency of the block containing the clobbers from the frequency of the previous basic block.