public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Save/restore value of pragma Normalize_Scalars
@ 2011-08-04 11:58 Arnaud Charlet
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaud Charlet @ 2011-08-04 11:58 UTC (permalink / raw)
  To: gcc-patches; +Cc: Javier Miranda

[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]

This patch adds the missing support to the frontend to save and restore
consistently the settings of pragma Normalize_Scalars. Required to have
consistent setting of its value when the compilation of a unit causes
implicit analysis of runtime units. Before applying this patch the
compilation of the following small test caused 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  <miranda@adacore.com>

	* opt.ads
	(Normalize_Scalars_Config): Value of the configuration switch set by
	pragma Normalize_Scalars when it appears in the gnat.adc file.
	(Normalize_Scalars): New field for record Config_Switches_Type. Used
	to save and restore settings of this pragma.
	* opt.adb
	(Register_Opt_Config_Switches, Save_Opt_Config_Switches,
	Restore_Opt_Config_Switches): Add missing support for Normalize_Scalars.


[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 3849 bytes --]

Index: opt.adb
===================================================================
--- opt.adb	(revision 177274)
+++ opt.adb	(working copy)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2010, Free Software Foundation, Inc.         --
+--          Copyright (C) 1992-2011, 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- --
@@ -59,6 +59,7 @@
       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;
@@ -93,6 +94,7 @@
       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;
@@ -122,6 +124,7 @@
       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;
@@ -189,6 +192,7 @@
          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;
Index: opt.ads
===================================================================
--- opt.ads	(revision 177356)
+++ opt.ads	(working copy)
@@ -1730,6 +1730,13 @@
    --  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
@@ -1911,6 +1918,7 @@
       Fast_Math                      : Boolean;
       Init_Or_Norm_Scalars           : Boolean;
       Initialize_Scalars             : Boolean;
+      Normalize_Scalars              : Boolean;
       Optimize_Alignment             : Character;
       Optimize_Alignment_Local       : Boolean;
       Persistent_BSS_Mode            : Boolean;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Ada] Save/restore value of pragma Normalize_Scalars
@ 2011-08-04 13:31 Arnaud Charlet
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaud Charlet @ 2011-08-04 13:31 UTC (permalink / raw)
  To: gcc-patches; +Cc: Javier Miranda

[-- Attachment #1: Type: text/plain, Size: 1339 bytes --]

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  <miranda@adacore.com>

	* 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.


[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 5472 bytes --]

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;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-04 13:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-04 11:58 [Ada] Save/restore value of pragma Normalize_Scalars Arnaud Charlet
2011-08-04 13:31 Arnaud Charlet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).