From patchwork Mon Sep 5 13:19:48 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 113362 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 56C65B6F7D for ; Mon, 5 Sep 2011 23:20:11 +1000 (EST) Received: (qmail 14270 invoked by alias); 5 Sep 2011 13:20:05 -0000 Received: (qmail 14230 invoked by uid 22791); 5 Sep 2011 13:20:02 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Sep 2011 13:19:49 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 4750A2BAF9A; Mon, 5 Sep 2011 09:19:48 -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 2DdhxFxT-Rix; Mon, 5 Sep 2011 09:19:48 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 2A41E2BAE94; Mon, 5 Sep 2011 09:19:48 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 1FC373FEE8; Mon, 5 Sep 2011 09:19:48 -0400 (EDT) Date: Mon, 5 Sep 2011 09:19:48 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Johannes Kanig Subject: [Ada] Cover all cases of constant objects for ALFA section in ALI files Message-ID: <20110905131948.GA14811@adacore.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 The test which filters constants objects so that they do not appear in the ALFA sections of ALI files did not cover all the cases. This patch corrects the problem. Tested on x86_64-pc-linux-gnu, committed on trunk 2011-09-05 Johannes Kanig * lib-xref-alfa.adb (Is_Alfa_Reference): Improve test for constant objects and rewrite case statement as /if/elsif/endif. Index: lib-xref-alfa.adb =================================================================== --- lib-xref-alfa.adb (revision 178536) +++ lib-xref-alfa.adb (working copy) @@ -604,38 +604,36 @@ Typ : Character) return Boolean is begin - -- The only references of interest on callable entities are calls. - -- On non-callable entities, the only references of interest are - -- reads and writes. - case Ekind (E) is - when Overloadable_Kind => - return Typ = 's'; + if Ekind (E) in Overloadable_Kind then - -- References to IN parameters and constants are not - -- considered in Alfa section, as these will be translated - -- as constants in the intermediate language for formal - -- verification, and should therefore never appear in frame - -- conditions. + -- The only references of interest on callable entities are + -- calls. On non-callable entities, the only references of + -- interest are reads and writes. - -- What about E_Loop_Parameter??? + return Typ = 's'; - when E_In_Parameter | E_Constant => + elsif Is_Constant_Object (E) then + + -- References to constant objects are not considered in Alfa + -- section, as these will be translated as constants in the + -- intermediate language for formal verification, and should + -- therefore never appear in frame conditions. + return False; - when others => + elsif Present (Etype (E)) and then + Ekind (Etype (E)) in Concurrent_Kind then - -- Objects of Task type or protected type are not Alfa - -- references. + -- Objects of Task type or protected type are not Alfa + -- references. - if Present (Etype (E)) - and then Ekind (Etype (E)) in Concurrent_Kind - then - return False; - end if; + return False; - return Typ = 'r' or else Typ = 'm'; - end case; + else + return Typ = 'r' or else Typ = 'm'; + + end if; end Is_Alfa_Reference; -------------------