From patchwork Thu Aug 4 13:31:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Charlet X-Patchwork-Id: 108459 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 84C50B6F57 for ; Thu, 4 Aug 2011 23:31:54 +1000 (EST) Received: (qmail 13527 invoked by alias); 4 Aug 2011 13:31:52 -0000 Received: (qmail 13513 invoked by uid 22791); 4 Aug 2011 13:31:51 -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; Thu, 04 Aug 2011 13:31:35 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 32D672BABA4; Thu, 4 Aug 2011 09:31:34 -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 FBcnUDetZ6zB; Thu, 4 Aug 2011 09:31:34 -0400 (EDT) Received: from kwai.gnat.com (kwai.gnat.com [205.232.38.4]) by rock.gnat.com (Postfix) with ESMTP id 0879D2BAB93; Thu, 4 Aug 2011 09:31:34 -0400 (EDT) Received: by kwai.gnat.com (Postfix, from userid 4192) id 0816C3FEE8; Thu, 4 Aug 2011 09:31:34 -0400 (EDT) Date: Thu, 4 Aug 2011 09:31:34 -0400 From: Arnaud Charlet To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [Ada] Save/restore value of pragma Normalize_Scalars Message-ID: <20110804133133.GA8028@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 This patch reverses the previous patch which saved/restore the values of pragma Normalize_Scalars because the value of Normalize_Scalars must not be saved/restored because once set to true its value never changes. That is, if a compilation unit has pragma Normalize_Scalars then it forces that value for all with'ed units. After this patch the compilation of the following small test must not cause an assertion failure in the frontend. with Ada.Text_IO; package ImpDef is end; pragma Normalize_Scalars; with Impdef; package CXH1001_0 is end; Command: gcc -c cxh1001_0.ads Tested on x86_64-pc-linux-gnu, committed on trunk 2011-08-04 Javier Miranda * opt.ads (Init_Or_Norm_Scalars_Config): Removed. (Normalize_Scalars_Config): Removed. * opt.adb (Register_Opt_Config_Switches): Remove registering config values of Init_Or_Norm_Scalars_Config and Normalize_Scalars_Config. (Restore_Opt_Config_Switches): Remove code which restores the values of Init_Or_Norm_Scalars and Normalize_Scalars. Recalculate value of Init_Or_Norm_Scalars. (Save_Opt_Config_Switches): Remove code which saves values of Init_Or_Norm_Scalars and Normalize_Scalars. (Set_Opt_Config_Switches): Remove code which restores config values of Init_Or_Norm_Scalars and Normalize_Scalars. Recalculate value of Init_Or_Norm_Scalars. Index: opt.adb =================================================================== --- opt.adb (revision 177360) +++ opt.adb (working copy) @@ -57,9 +57,7 @@ External_Name_Exp_Casing_Config := External_Name_Exp_Casing; External_Name_Imp_Casing_Config := External_Name_Imp_Casing; Fast_Math_Config := Fast_Math; - Init_Or_Norm_Scalars_Config := Init_Or_Norm_Scalars; Initialize_Scalars_Config := Initialize_Scalars; - Normalize_Scalars_Config := Normalize_Scalars; Optimize_Alignment_Config := Optimize_Alignment; Persistent_BSS_Mode_Config := Persistent_BSS_Mode; Polling_Required_Config := Polling_Required; @@ -92,15 +90,20 @@ External_Name_Exp_Casing := Save.External_Name_Exp_Casing; External_Name_Imp_Casing := Save.External_Name_Imp_Casing; Fast_Math := Save.Fast_Math; - Init_Or_Norm_Scalars := Save.Init_Or_Norm_Scalars; Initialize_Scalars := Save.Initialize_Scalars; - Normalize_Scalars := Save.Normalize_Scalars; Optimize_Alignment := Save.Optimize_Alignment; Optimize_Alignment_Local := Save.Optimize_Alignment_Local; Persistent_BSS_Mode := Save.Persistent_BSS_Mode; Polling_Required := Save.Polling_Required; Short_Descriptors := Save.Short_Descriptors; Use_VADS_Size := Save.Use_VADS_Size; + + -- Update consistently the value of Init_Or_Norm_Scalars. The value of + -- Normalize_Scalars is not saved/restored because after set to True its + -- value is never changed. That is, if a compilation unit has pragma + -- Normalize_Scalars then it forces that value for all with'ed units. + + Init_Or_Norm_Scalars := Initialize_Scalars or Normalize_Scalars; end Restore_Opt_Config_Switches; ------------------------------ @@ -122,9 +125,7 @@ Save.External_Name_Exp_Casing := External_Name_Exp_Casing; Save.External_Name_Imp_Casing := External_Name_Imp_Casing; Save.Fast_Math := Fast_Math; - Save.Init_Or_Norm_Scalars := Init_Or_Norm_Scalars; Save.Initialize_Scalars := Initialize_Scalars; - Save.Normalize_Scalars := Normalize_Scalars; Save.Optimize_Alignment := Optimize_Alignment; Save.Optimize_Alignment_Local := Optimize_Alignment_Local; Save.Persistent_BSS_Mode := Persistent_BSS_Mode; @@ -190,13 +191,19 @@ External_Name_Exp_Casing := External_Name_Exp_Casing_Config; External_Name_Imp_Casing := External_Name_Imp_Casing_Config; Fast_Math := Fast_Math_Config; - Init_Or_Norm_Scalars := Init_Or_Norm_Scalars_Config; Initialize_Scalars := Initialize_Scalars_Config; - Normalize_Scalars := Normalize_Scalars_Config; Optimize_Alignment := Optimize_Alignment_Config; Optimize_Alignment_Local := False; Persistent_BSS_Mode := Persistent_BSS_Mode_Config; Use_VADS_Size := Use_VADS_Size_Config; + + -- Update consistently the value of Init_Or_Norm_Scalars. The value + -- of Normalize_Scalars is not saved/restored because once set to + -- True its value is never changed. That is, if a compilation unit + -- has pragma Normalize_Scalars then it forces that value for all + -- with'ed units. + + Init_Or_Norm_Scalars := Initialize_Scalars or Normalize_Scalars; end if; Default_Pool := Default_Pool_Config; Index: opt.ads =================================================================== --- opt.ads (revision 177360) +++ opt.ads (working copy) @@ -1718,11 +1718,6 @@ -- used to set the initial value of Fast_Math at the start of each new -- compilation unit. - Init_Or_Norm_Scalars_Config : Boolean; - -- GNAT - -- This is the value of the configuration switch that is set by one - -- of the pragmas Initialize_Scalars or Normalize_Scalars. - Initialize_Scalars_Config : Boolean; -- GNAT -- This is the value of the configuration switch that is set by the @@ -1730,13 +1725,6 @@ -- This switch is not set when the pragma appears ahead of a given -- unit, so it does not affect the compilation of other units. - Normalize_Scalars_Config : Boolean; - -- GNAT - -- This is the value of the configuration switch that is set by the - -- pragma Normalize_Scalars when it appears in the gnat.adc file. - -- This switch is not set when the pragma appears ahead of a given - -- unit, so it does not affect the compilation of other units. - Optimize_Alignment_Config : Character; -- GNAT -- This is the value of the configuration switch that controls the @@ -1916,7 +1904,6 @@ External_Name_Exp_Casing : External_Casing_Type; External_Name_Imp_Casing : External_Casing_Type; Fast_Math : Boolean; - Init_Or_Norm_Scalars : Boolean; Initialize_Scalars : Boolean; Normalize_Scalars : Boolean; Optimize_Alignment : Character;