From patchwork Thu Nov 15 19:34:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 199389 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id E4CEC2C037A for ; Fri, 16 Nov 2012 06:37:16 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1353613037; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Cc:Subject:Date:Message-ID:User-Agent: MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=15jbMqMaFaS2/+7zC1ah+7oixZY=; b=gsMIYTKi3JqXRY8aRAk+yfUSmVHHBcq3TbnlGtfjy/S4h5ms4V6ShjQ2/HPM6n RXBOHfttPvR9lz5Amltw9riIPlDm21KfeFqxB7kPQxyYiiW6lPn+7AicAj0Lsyba ivC5vJhgQk8e7CAYaIM6GJtaOr0sv9HchdO3Ur/nEuZAU= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:From:To:Cc:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:Content-Transfer-Encoding:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=sd6KujZ5A8Iq7HeLw7RS2fdQXkBbNrTLjXW6ubq8SKRRSJqVn5L95IWNd+oNB2 qPVAWwprxO7OYAdgfrVjtZPdaOdc3whYgDHSUVm160WfdukxEzjg3e1vctM3e/Vx hX0N1PZg9fYf/iTOwmBClvzHF5qW/6uSJhypHNBblObHU=; Received: (qmail 5361 invoked by alias); 15 Nov 2012 19:37:13 -0000 Received: (qmail 5211 invoked by uid 22791); 15 Nov 2012 19:37:12 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mel.act-europe.fr (HELO mel.act-europe.fr) (194.98.77.210) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 15 Nov 2012 19:37:07 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 84CDDCB13B9; Thu, 15 Nov 2012 20:37:09 +0100 (CET) Received: from mel.act-europe.fr ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DoJ3F2eIrdP4; Thu, 15 Nov 2012 20:37:09 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mel.act-europe.fr (Postfix) with ESMTP id 4C866CB13A7; Thu, 15 Nov 2012 20:37:09 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Cc: Richard Henderson Subject: [patch] Fix PR middle-end/55321 Date: Thu, 15 Nov 2012 20:34:38 +0100 Message-ID: <1847684.pGViGHtxfN@polaris> User-Agent: KMail/4.7.2 (Linux/3.1.10-1.16-desktop; KDE/4.7.2; x86_64; ; ) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, this is the build failure of the Ada runtime on the ARM: +===========================GNAT BUG DETECTED==============================+ | 4.8.0 20121111 (experimental) (armv5tel-unknown-linux-gnueabi) GCC error:| | in merge_latch_edges, at cfgloop.c:678 | | Error detected around s-stposu.adb:565:8 | | Please submit a bug report; see http://gcc.gnu.org/bugs.html. The problem is that get_loop_latch_edges finds no latch edges for a loop because the header of the loop doesn't dominate any of its predecessors. The reason is that a new edge is added during RTL expansion, which changes the dominance info. This edge is from a call to __sync_synchronize to a non-local label generated for a __builtin_setjmp_receiver. Fixed by marking the call as "nononlocal", tested on x86_64-suse-linux, OK for the mainline? 2012-11-15 Eric Botcazou PR middle-end/55321 * optabs.c (mark_nothrow_nononlocal): New function extracted from... (emit_libcall_block_1): ...here. Call it. (expand_mem_thread_fence): Call it for synchronize_libfunc. 2012-11-15 Eric Botcazou * loop_optimization14.ad[sb]: New test. * loop_optimization14_pkg.ads: New helper. Index: optabs.c =================================================================== --- optabs.c (revision 193528) +++ optabs.c (working copy) @@ -3838,6 +3838,23 @@ no_conflict_move_test (rtx dest, const_r } +/* Look for any CALL_INSNs in the insn chain starting at INSN and attach a + REG_EH_REGION reg note to indicate that this call cannot throw or execute + a nonlocal goto (unless there is already a REG_EH_REGION note, in which + case we update it). */ + +static void +mark_nothrow_nononlocal (rtx insn) +{ + while (insn) + { + if (CALL_P (insn)) + make_reg_eh_region_note_nothrow_nononlocal (insn); + + insn = NEXT_INSN (insn); + } +} + /* Emit code to make a call to a constant function or a library call. INSNS is a list containing all insns emitted in the call. @@ -3881,15 +3898,7 @@ emit_libcall_block_1 (rtx insns, rtx tar } } else - { - /* Look for any CALL_INSNs in this sequence, and attach a REG_EH_REGION - reg note to indicate that this call cannot throw or execute a nonlocal - goto (unless there is already a REG_EH_REGION note, in which case - we update it). */ - for (insn = insns; insn; insn = NEXT_INSN (insn)) - if (CALL_P (insn)) - make_reg_eh_region_note_nothrow_nononlocal (insn); - } + mark_nothrow_nononlocal (insns); /* First emit all insns that set pseudos. Remove them from the list as we go. Avoid insns that set pseudos which were referenced in previous @@ -7404,7 +7413,15 @@ expand_mem_thread_fence (enum memmodel m if (HAVE_memory_barrier) emit_insn (gen_memory_barrier ()); else if (synchronize_libfunc != NULL_RTX) - emit_library_call (synchronize_libfunc, LCT_NORMAL, VOIDmode, 0); + { + rtx insns; + start_sequence (); + emit_library_call (synchronize_libfunc, LCT_NORMAL, VOIDmode, 0); + insns = get_insns (); + end_sequence (); + mark_nothrow_nononlocal (insns); + emit_insn (insns); + } else expand_asm_memory_barrier (); }