[Ada] Disable Initialize_Scalars on runtime files

Message ID 20200716092051.GA146446@adacore.com
State New
Headers show
Series
  • [Ada] Disable Initialize_Scalars on runtime files
Related show

Commit Message

Pierre-Marie de Rodat July 16, 2020, 9:20 a.m.
To avoid creating circular dependencies between runtime units and to
allow compiling e.g. GNAT with Initialize_Scalars.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* frontend.adb: Disable Initialize_Scalars on runtime files.

Patch

diff --git a/gcc/ada/frontend.adb b/gcc/ada/frontend.adb
--- a/gcc/ada/frontend.adb
+++ b/gcc/ada/frontend.adb
@@ -382,6 +382,16 @@  begin
          Warn_On_Non_Local_Exception := True;
       end if;
 
+      --  Disable Initialize_Scalars for runtime files to avoid circular
+      --  dependencies.
+
+      if Initialize_Scalars
+        and then Fname.Is_Predefined_File_Name (File_Name (Main_Source_File))
+      then
+         Initialize_Scalars   := False;
+         Init_Or_Norm_Scalars := Normalize_Scalars;
+      end if;
+
       --  Now on to the semantics. Skip if in syntax only mode
 
       if Operating_Mode /= Check_Syntax then