From patchwork Fri Jul 5 10:25:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 257077 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id DA5EB2C0091 for ; Fri, 5 Jul 2013 20:25:48 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=PnX8jdQOPgj5jcQeZHyuBuKfBTDDAkSAVLccTSmV3XzH4+O7xX ITyZH2RjbJ3R9GhF9VTRM/O7H0KF2u1Jaov/2UKp+riWmes08WYRVdapyfgxkYKU odrZ31wLJ+A77Z7YmyPwsCxfBPTsXb9QgF20bjX4y8AbB97tXfx2lrdOA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:mime-version:content-type; s= default; bh=195LTFD7TnhigJYH6AlwFqCvBz0=; b=mUWP/DWKprHs/ITT1AyS t9TGrd6HvDGPSzvvZawoysnLnolVDHPQp6HLEIYS/LbYthvc0E2UZaZGpSep5x7f Jafoy7+8HWcgFiUyLeZCZg1wSfO+T2bL7u/oqMzj/LVwoUIoYiWjx2mudwbICo1A GUdkQJ0x4MuRnnkUAcrY5jA= Received: (qmail 3315 invoked by alias); 5 Jul 2013 10:25:40 -0000 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 Received: (qmail 3306 invoked by uid 89); 5 Jul 2013 10:25:40 -0000 X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, RCVD_IN_HOSTKARMA_NO autolearn=ham version=3.3.1 Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Fri, 05 Jul 2013 10:25:31 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id C42F21C6823; Fri, 5 Jul 2013 06:25:29 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id FjFCq-g9ZJWZ; Fri, 5 Jul 2013 06:25:29 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 865301C6729; Fri, 5 Jul 2013 06:25:29 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 84EDD3FB31; Fri, 5 Jul 2013 06:25:29 -0400 (EDT) Date: Fri, 5 Jul 2013 06:25:29 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Yannick Moy Subject: [Ada] Force instantiation of subprogram body in SPARK mode Message-ID: <20130705102529.GA29290@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Found: No In the SPARK mode for formal verification, force the instantiation of a subprogram body, so that the formal verification backend can analyze it. Tested on x86_64-pc-linux-gnu, committed on trunk 2013-07-05 Yannick Moy * sem_ch12.ads, sem_ch12.adb (Need_Subprogram_Instance_Body): Force instance of subprogram body in SPARK mode, by testing Expander_Active (set in SPARK mode) instead of Full_Expander_Active (not set in SPARK mode). * sem_ch8.adb: Minor reformatting. Index: sem_ch12.adb =================================================================== --- sem_ch12.adb (revision 200695) +++ sem_ch12.adb (working copy) @@ -4367,13 +4367,17 @@ Subp : Entity_Id) return Boolean is begin + -- This complex conditional requires blow by blow comments ??? + if (Is_In_Main_Unit (N) or else Is_Inlined (Subp) or else Is_Inlined (Alias (Subp))) and then (Operating_Mode = Generate_Code or else (Operating_Mode = Check_Semantics and then ASIS_Mode)) - and then (Full_Expander_Active or else ASIS_Mode) + -- The following line definitely requires comments, why do we + -- test Expander_Active and not Full_Expander_Active here ??? + and then (Expander_Active or ASIS_Mode) and then not ABE_Is_Certain (N) and then not Is_Eliminated (Subp) then Index: sem_ch12.ads =================================================================== --- sem_ch12.ads (revision 200688) +++ sem_ch12.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -113,7 +113,6 @@ function Need_Subprogram_Instance_Body (N : Node_Id; Subp : Entity_Id) return Boolean; - -- If a subprogram instance is inlined, indicate that the body of it -- must be created, to be used in inlined calls by the back-end. The -- subprogram may be inlined because the generic itself carries the Index: sem_ch8.adb =================================================================== --- sem_ch8.adb (revision 200688) +++ sem_ch8.adb (working copy) @@ -2816,7 +2816,7 @@ -- The following is illegal, because F hides whatever other F may -- be around: - -- function F (..) renames F; + -- function F (...) renames F; elsif Old_S = New_S or else (Nkind (Nam) /= N_Expanded_Name @@ -2824,6 +2824,10 @@ then Error_Msg_N ("subprogram cannot rename itself", N); + -- This is illegal even if we use a selector: + -- function F (...) renames Pkg.F; + -- because F is still hidden. + elsif Nkind (Nam) = N_Expanded_Name and then Entity (Prefix (Nam)) = Current_Scope and then Chars (Selector_Name (Nam)) = Chars (New_S)