From patchwork Sun Mar 25 17:09:11 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 148573 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 ADDC3B6EF3 for ; Mon, 26 Mar 2012 04:15:08 +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=1333300512; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:User-Agent:MIME-Version: Content-Type:Message-Id:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=nd9GRifigkWVtsnG+PAAoIrHAbk=; b=qGVk07EbjzIn4Cl ii50Ktegvuc7nCTZpx3NxHUElpKjAgPPXujAgDMn2yqz3qjhguYaloo+fi9Hjslx aO+O1iwF8wzJH4j68rdXU4Mdqc8C7Qeaay7oF2pWv4BX8alIWkuONa77aLqdSisb 3iwZnXbszr9jM2K/EAt1I6jhuTbc= 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:Subject:Date:User-Agent:MIME-Version:Content-Type:Message-Id:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=K0cqHwi8Hc3I8cFEyX/dfXxq0ethzbDumNTfmIeRBTLDmbZ9UMmaipU9UELvqI XhzF2qOojDnzG9DrdOyxnYOWvszIrCe71K3T00rliLijXlZLrj37hZratpxM787P Rt0+dtM+RU6QcQEP1NlsrjmBqnbX/v76yZgSLS2TYFxcI=; Received: (qmail 5988 invoked by alias); 25 Mar 2012 17:14:59 -0000 Received: (qmail 5980 invoked by uid 22791); 25 Mar 2012 17:14:57 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,TW_TJ 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; Sun, 25 Mar 2012 17:14:43 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 8072A29002C for ; Sun, 25 Mar 2012 19:14:45 +0200 (CEST) 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 dIOeMjPqwBBd for ; Sun, 25 Mar 2012 19:14:45 +0200 (CEST) Received: from [192.168.1.2] (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 42788290027 for ; Sun, 25 Mar 2012 19:14:45 +0200 (CEST) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix ICE in insert_clobbers_for_var in SJLJ mode Date: Sun, 25 Mar 2012 19:09:11 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Message-Id: <201203251909.11857.ebotcazou@adacore.com> 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 We have a call to builtin_alloca_with_align: S10b.27_153 = .builtin_alloca_with_align (5, 8); and CCP replaces it with a static allocation: S10b.27_153 = &TMP; and is trying to add a special out-of-scope CLOBBER for the new variable TMP, under the assumption that every call to builtin_alloca_with_align is dominated by a call to builtin_stack_save. But this isn't true here: : FRAME.29.M17b = system.secondary_stack.ss_mark (); [return slot optimization] : saved_stack.28_9(ab) = .builtin_stack_save (); because the call to system.secondary_stack.ss_mark creates an abnormal edge to the setjmp dispatcher and we have a setjmp receiver after builtin_stack_save. This is a latent issue and GCC 4.7+ now chokes on it. The way out is to tell the compiler that system.secondary_stack.ss_mark is a well-behaved function, more precisely a "leaf" function. Tested on i586-suse-linux, applied on the mainline and 4.7 branch. 2012-03-25 Eric Botcazou * gcc-interface/decl.c (SS_MARK_NAME): New define. (gnat_to_gnu_entity) : Prepend leaf attribute on entities whose name is SS_MARK_NAME. 2012-03-25 Eric Botcazou * gnat.dg/concat2.ad[sb]: New test. Index: gcc-interface/decl.c =================================================================== --- gcc-interface/decl.c (revision 185779) +++ gcc-interface/decl.c (working copy) @@ -81,6 +81,9 @@ #define FOREIGN_FORCE_REALIGN_STACK 0 #endif +/* The (internal) name of the System.Secondary_Stack.SS_Mark function. */ +#define SS_MARK_NAME "system__secondary_stack__ss_mark" + struct incomplete { struct incomplete *next; @@ -4405,6 +4408,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entit get_identifier ("force_align_arg_pointer"), NULL_TREE, gnat_entity); + /* ??? Declare System.Secondary_Stack.SS_Mark as leaf, in order to + avoid creating abnormal edges in SJLJ mode, which can break the + dominance relationship if there is a dynamic stack allocation. + We cannot do this in System.Secondary_Stack directly since it's + a compiler unit and this would introduce bootstrap path issues. */ + if (IDENTIFIER_LENGTH (gnu_entity_name) == strlen (SS_MARK_NAME) + && IDENTIFIER_POINTER (gnu_entity_name)[0] == SS_MARK_NAME[0] + && IDENTIFIER_POINTER (gnu_entity_name)[1] == SS_MARK_NAME[1] + && IDENTIFIER_POINTER (gnu_entity_name)[2] == SS_MARK_NAME[2] + && gnu_entity_name == get_identifier (SS_MARK_NAME)) + prepend_one_attribute_to + (&attr_list, ATTR_MACHINE_ATTRIBUTE, + get_identifier ("leaf"), NULL_TREE, + gnat_entity); + /* The lists have been built in reverse. */ gnu_param_list = nreverse (gnu_param_list); if (has_stub)