diff mbox series

[Ada] Fix type mismatch warnings during LTO bootstrap #3

Message ID 20210507093823.GA140751@adacore.com
State New
Headers show
Series [Ada] Fix type mismatch warnings during LTO bootstrap #3 | expand

Commit Message

Pierre-Marie de Rodat May 7, 2021, 9:38 a.m. UTC
This changes a type name to avoid a violation of the C++ ODR with LTO,
sets convention C on another enumeration type and declares a matching
enumeration type in C, fixes a blatant type mismatch, marks components
as aliased in a couple of record types and tweaks one of them a bit more.

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

gcc/ada/

	* atree.h (Slots_Ptr): Change pointed-to type to any_slot.
	* fe.h (Get_RT_Exception_Name): Change type of parameter.
	* namet.ads (Name_Entry): Mark non-boolean components as aliased,
	reorder the boolean components and add an explicit Spare component.
	* namet.adb (Name_Enter): Adjust aggregate accordingly.
	(Name_Find): Likewise.
	(Reinitialize): Likewise.
	* namet.h (struct Name_Entry): Adjust accordingly.
	(Names_Ptr): Use correct type.
	(Name_Chars_Ptr): Likewise.
	(Get_Name_String): Fix declaration and adjust to above changes.
	* types.ads (RT_Exception_Code): Add pragma Convention C.
	* types.h (Column_Number_Type): Fix original type.
	(slot): Rename union type to...
	(any_slot): ...this and adjust assertion accordingly.
	(RT_Exception_Code): New enumeration type.
	* uintp.ads (Uint_Entry): Mark components as aliased.
	* uintp.h (Uints_Ptr):  Use correct type.
	(Udigits_Ptr): Likewise.
	* gcc-interface/gigi.h (gigi): Adjust name and type of parameter.
	* gcc-interface/cuintp.c (UI_To_gnu): Adjust references to Uints_Ptr
	and Udigits_Ptr.
	* gcc-interface/trans.c (Slots_Ptr): Adjust pointed-to type.
	(gigi): Adjust type of parameter.
	(build_raise_check): Add cast in call to Get_RT_Exception_Name.
diff mbox series

Patch

diff --git a/gcc/ada/atree.h b/gcc/ada/atree.h
--- a/gcc/ada/atree.h
+++ b/gcc/ada/atree.h
@@ -70,7 +70,7 @@  extern Node_Id Current_Error_Node;
    these even-lower-level getters.  */
 
 extern Field_Offset *Node_Offsets_Ptr;
-extern slot *Slots_Ptr;
+extern any_slot *Slots_Ptr;
 
 INLINE Union_Id Get_1_Bit_Field (Node_Id N, Field_Offset Offset);
 INLINE Union_Id Get_2_Bit_Field (Node_Id N, Field_Offset Offset);


diff --git a/gcc/ada/fe.h b/gcc/ada/fe.h
--- a/gcc/ada/fe.h
+++ b/gcc/ada/fe.h
@@ -122,7 +122,7 @@  extern Uint Error_Msg_Uint_2;
 
 extern Entity_Id Get_Local_Raise_Call_Entity	(void);
 extern Entity_Id Get_RT_Exception_Entity	(int);
-extern void Get_RT_Exception_Name		(int);
+extern void Get_RT_Exception_Name		(enum RT_Exception_Code);
 extern void Warn_If_No_Local_Raise		(int);
 
 /* exp_code:  */


diff --git a/gcc/ada/gcc-interface/cuintp.c b/gcc/ada/gcc-interface/cuintp.c
--- a/gcc/ada/gcc-interface/cuintp.c
+++ b/gcc/ada/gcc-interface/cuintp.c
@@ -49,8 +49,7 @@ 
 
    For efficiency, this method is used only for integer values larger than the
    constant Uint_Bias.  If a Uint is less than this constant, then it contains
-   the integer value itself.  The origin of the Uints_Ptr table is adjusted so
-   that a Uint value of Uint_Bias indexes the first element.
+   the integer value itself.
 
    First define a utility function that is build_int_cst for integral types and
    does a conversion for floating-point types.  */
@@ -85,9 +84,9 @@  UI_To_gnu (Uint Input, tree type)
     gnu_ret = build_cst_from_int (comp_type, Input - Uint_Direct_Bias);
   else
     {
-      Int Idx = Uints_Ptr[Input].Loc;
-      Pos Length = Uints_Ptr[Input].Length;
-      Int First = Udigits_Ptr[Idx];
+      Int Idx = (*Uints_Ptr)[Input - Uint_Table_Start].Loc;
+      Pos Length = (*Uints_Ptr)[Input - Uint_Table_Start].Length;
+      Int First = (*Udigits_Ptr)[Idx];
       tree gnu_base;
 
       gcc_assert (Length > 0);
@@ -109,14 +108,14 @@  UI_To_gnu (Uint Input, tree type)
 				 fold_build2 (MULT_EXPR, comp_type,
 					      gnu_ret, gnu_base),
 				 build_cst_from_int (comp_type,
-						     Udigits_Ptr[Idx]));
+						     (*Udigits_Ptr)[Idx]));
       else
 	for (Idx++, Length--; Length; Idx++, Length--)
 	  gnu_ret = fold_build2 (PLUS_EXPR, comp_type,
 				 fold_build2 (MULT_EXPR, comp_type,
 					      gnu_ret, gnu_base),
 				 build_cst_from_int (comp_type,
-						     Udigits_Ptr[Idx]));
+						     (*Udigits_Ptr)[Idx]));
     }
 
   gnu_ret = convert (type, gnu_ret);


diff --git a/gcc/ada/gcc-interface/gigi.h b/gcc/ada/gcc-interface/gigi.h
--- a/gcc/ada/gcc-interface/gigi.h
+++ b/gcc/ada/gcc-interface/gigi.h
@@ -235,7 +235,7 @@  extern void gigi (Node_Id gnat_root,
 	          int max_gnat_node,
 		  int number_name,
 		  Field_Offset *node_offsets_ptr,
-		  slot *Slots,
+		  any_slot *slots_ptr,
 		  Node_Id *next_node_ptr,
 		  Node_Id *prev_node_ptr,
 		  struct Elist_Header *elists_ptr,


diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -76,7 +76,7 @@ 
 
 /* Pointers to front-end tables accessed through macros.  */
 Field_Offset *Node_Offsets_Ptr;
-slot *Slots_Ptr;
+any_slot *Slots_Ptr;
 Node_Id *Next_Node_Ptr;
 Node_Id *Prev_Node_Ptr;
 struct Elist_Header *Elists_Ptr;
@@ -280,7 +280,7 @@  gigi (Node_Id gnat_root,
       int max_gnat_node,
       int number_name ATTRIBUTE_UNUSED,
       Field_Offset *node_offsets_ptr,
-      slot *slots_ptr,
+      any_slot *slots_ptr,
       Node_Id *next_node_ptr,
       Node_Id *prev_node_ptr,
       struct Elist_Header *elists_ptr,
@@ -752,7 +752,7 @@  build_raise_check (int check, enum exception_info_kind kind)
 
   strcpy (Name_Buffer, pfx);
   Name_Len = sizeof (pfx) - 1;
-  Get_RT_Exception_Name (check);
+  Get_RT_Exception_Name ((enum RT_Exception_Code) check);
 
   if (kind == exception_simple)
     {


diff --git a/gcc/ada/namet.adb b/gcc/ada/namet.adb
--- a/gcc/ada/namet.adb
+++ b/gcc/ada/namet.adb
@@ -1133,11 +1133,12 @@  package body Namet is
           Name_Len              => Short (Buf.Length),
           Byte_Info             => 0,
           Int_Info              => 0,
+          Hash_Link             => No_Name,
+          Name_Has_No_Encodings => False,
           Boolean1_Info         => False,
           Boolean2_Info         => False,
           Boolean3_Info         => False,
-          Name_Has_No_Encodings => False,
-          Hash_Link             => No_Name));
+          Spare                 => False));
 
       --  Set corresponding string entry in the Name_Chars table
 
@@ -1239,12 +1240,13 @@  package body Namet is
            ((Name_Chars_Index      => Name_Chars.Last,
              Name_Len              => Short (Buf.Length),
              Hash_Link             => No_Name,
-             Name_Has_No_Encodings => False,
              Int_Info              => 0,
              Byte_Info             => 0,
+             Name_Has_No_Encodings => False,
              Boolean1_Info         => False,
              Boolean2_Info         => False,
-             Boolean3_Info         => False));
+             Boolean3_Info         => False,
+             Spare                 => False));
 
          --  Set corresponding string entry in the Name_Chars table
 
@@ -1324,11 +1326,12 @@  package body Namet is
              Name_Len              => 1,
              Byte_Info             => 0,
              Int_Info              => 0,
+             Hash_Link             => No_Name,
+             Name_Has_No_Encodings => True,
              Boolean1_Info         => False,
              Boolean2_Info         => False,
              Boolean3_Info         => False,
-             Name_Has_No_Encodings => True,
-             Hash_Link             => No_Name));
+             Spare                 => False));
 
          Name_Chars.Append (C);
          Name_Chars.Append (ASCII.NUL);


diff --git a/gcc/ada/namet.ads b/gcc/ada/namet.ads
--- a/gcc/ada/namet.ads
+++ b/gcc/ada/namet.ads
@@ -570,33 +570,36 @@  private
      Table_Name           => "Name_Chars");
 
    type Name_Entry is record
-      Name_Chars_Index : Int;
+      Name_Chars_Index : aliased Int;
       --  Starting location of characters in the Name_Chars table minus one
       --  (i.e. pointer to character just before first character). The reason
       --  for the bias of one is that indexes in Name_Buffer are one's origin,
       --  so this avoids unnecessary adds and subtracts of 1.
 
-      Name_Len : Short;
+      Name_Len : aliased Short;
       --  Length of this name in characters
 
-      Byte_Info : Byte;
+      Byte_Info : aliased Byte;
       --  Byte value associated with this name
 
-      Boolean1_Info : Boolean;
-      Boolean2_Info : Boolean;
-      Boolean3_Info : Boolean;
-      --  Boolean values associated with the name
-
       Name_Has_No_Encodings : Boolean;
       --  This flag is set True if the name entry is known not to contain any
       --  special character encodings. This is used to speed up repeated calls
       --  to Append_Decoded. A value of False means that it is not known
       --  whether the name contains any such encodings.
 
-      Hash_Link : Name_Id;
+      Boolean1_Info : Boolean;
+      Boolean2_Info : Boolean;
+      Boolean3_Info : Boolean;
+      --  Boolean values associated with the name
+
+      Spare : Boolean;
+      --  Four remaining bits in the current byte
+
+      Hash_Link : aliased Name_Id;
       --  Link to next entry in names table for same hash code
 
-      Int_Info : Int;
+      Int_Info : aliased Int;
       --  Int Value associated with this name
 
    end record;
@@ -605,10 +608,11 @@  private
       Name_Chars_Index      at  0 range 0 .. 31;
       Name_Len              at  4 range 0 .. 15;
       Byte_Info             at  6 range 0 .. 7;
-      Boolean1_Info         at  7 range 0 .. 0;
-      Boolean2_Info         at  7 range 1 .. 1;
-      Boolean3_Info         at  7 range 2 .. 2;
-      Name_Has_No_Encodings at  7 range 3 .. 7;
+      Name_Has_No_Encodings at  7 range 0 .. 0;
+      Boolean1_Info         at  7 range 1 .. 1;
+      Boolean2_Info         at  7 range 2 .. 2;
+      Boolean3_Info         at  7 range 3 .. 3;
+      Spare                 at  7 range 4 .. 7;
       Hash_Link             at  8 range 0 .. 31;
       Int_Info              at 12 range 0 .. 31;
    end record;


diff --git a/gcc/ada/namet.h b/gcc/ada/namet.h
--- a/gcc/ada/namet.h
+++ b/gcc/ada/namet.h
@@ -32,26 +32,28 @@ 
 extern "C" {
 #endif
 
-/* Structure defining a names table entry.  */
-
+/* Structure defining a name table entry.  */
 struct Name_Entry
 {
-  Int Name_Chars_Index; /* Starting location of char in Name_Chars table. */
-  Short Name_Len;         /* Length of this name in characters. */
-  Byte Byte_Info;       /* Byte value associated with this name */
-  Byte Spare;           /* Unused */
-  Name_Id Hash_Link;    /* Link to next entry in names table for same hash
-                           code. Not accessed by C routines.  */
-  Int Int_Info;         /* Int value associated with this name */
+  Int Name_Chars_Index;
+  Short Name_Len;
+  Byte Byte_Info;
+  Byte Name_Has_No_Encodings : 1;
+  Byte Boolean1_Info : 1;
+  Byte Boolean2_Info : 1;
+  Byte Boolean3_Info : 1;
+  Byte Spare : 4;
+  Name_Id Hash_Link;
+  Int Int_Info;
 };
 
-/* Pointer to names table vector. */
+/* Pointer to the name table.  */
 #define Names_Ptr namet__name_entries__table
-extern struct Name_Entry *Names_Ptr;
+extern struct Name_Entry (*Names_Ptr)[];
 
-/* Pointer to name characters table. */
+/* Pointer to the name character table.  */
 #define Name_Chars_Ptr namet__name_chars__table
-extern char *Name_Chars_Ptr;
+extern char (*Name_Chars_Ptr)[];
 
 /* This is Hostparm.Max_Line_Length.  */
 #define Max_Line_Length (32767 - 1)
@@ -75,12 +77,13 @@  extern struct Bounded_String Global_Name_Buffer;
    strings we want are sitting in the name strings table in exactly the form
    we need them (NUL terminated), we just point to the name directly. */
 
-static char *Get_Name_String (Name_Id);
+INLINE char *Get_Name_String (Name_Id);
 
 INLINE char *
 Get_Name_String (Name_Id Id)
 {
-  return Name_Chars_Ptr + Names_Ptr[Id - First_Name_Id].Name_Chars_Index + 1;
+  return
+    &(*Name_Chars_Ptr)[(*Names_Ptr)[Id - First_Name_Id].Name_Chars_Index + 1];
 }
 
 #define Name_Equals namet__name_equals


diff --git a/gcc/ada/types.ads b/gcc/ada/types.ads
--- a/gcc/ada/types.ads
+++ b/gcc/ada/types.ads
@@ -930,6 +930,7 @@  package Types is
       SE_Object_Too_Large,               -- 35
       PE_Stream_Operation_Not_Allowed,   -- 36
       PE_Build_In_Place_Mismatch);       -- 37
+   pragma Convention (C, RT_Exception_Code);
 
    Last_Reason_Code : constant :=
      RT_Exception_Code'Pos (RT_Exception_Code'Last);


diff --git a/gcc/ada/types.h b/gcc/ada/types.h
--- a/gcc/ada/types.h
+++ b/gcc/ada/types.h
@@ -122,7 +122,7 @@  typedef Char *Text_Buffer_Ptr;
 typedef Int Line_Number_Type;
 
 /* Column number type, used for storing all column numbers.  */
-typedef Int Column_Number_Type;
+typedef Short Column_Number_Type;
 
 /* Type used to store text of a source file.  */
 typedef Text_Buffer Source_Buffer;
@@ -372,147 +372,151 @@  typedef char Float_Rep_Kind;
 
 typedef Nat Small_Paren_Count_Type;
 
-/* Definitions of Reason codes for Raise_xxx_Error nodes */
-#define CE_Access_Check_Failed              0
-#define CE_Access_Parameter_Is_Null         1
-#define CE_Discriminant_Check_Failed        2
-#define CE_Divide_By_Zero                   3
-#define CE_Explicit_Raise                   4
-#define CE_Index_Check_Failed               5
-#define CE_Invalid_Data                     6
-#define CE_Length_Check_Failed              7
-#define CE_Null_Exception_Id                8
-#define CE_Null_Not_Allowed                 9
-#define CE_Overflow_Check_Failed           10
-#define CE_Partition_Check_Failed          11
-#define CE_Range_Check_Failed              12
-#define CE_Tag_Check_Failed                13
-
-#define PE_Access_Before_Elaboration       14
-#define PE_Accessibility_Check_Failed      15
-#define PE_Address_Of_Intrinsic            16
-#define PE_Aliased_Parameters              17
-#define PE_All_Guards_Closed               18
-#define PE_Bad_Predicated_Generic_Type     19
-#define PE_Build_In_Place_Mismatch         37
-#define PE_Current_Task_In_Entry_Body      20
-#define PE_Duplicated_Entry_Address        21
-#define PE_Explicit_Raise                  22
-#define PE_Finalize_Raised_Exception       23
-#define PE_Implicit_Return                 24
-#define PE_Misaligned_Address_Value        25
-#define PE_Missing_Return                  26
-#define PE_Non_Transportable_Actual        31
-#define PE_Overlaid_Controlled_Object      27
-#define PE_Potentially_Blocking_Operation  28
-#define PE_Stream_Operation_Not_Allowed    36
-#define PE_Stubbed_Subprogram_Called       29
-#define PE_Unchecked_Union_Restriction     30
-
-#define SE_Empty_Storage_Pool              32
-#define SE_Explicit_Raise                  33
-#define SE_Infinite_Recursion              34
-#define SE_Object_Too_Large                35
-
-#define LAST_REASON_CODE                   37
-
 typedef Nat Field_Offset;
 
 typedef struct
 {
-    unsigned f0 : 1;
-    unsigned f1 : 1;
-    unsigned f2 : 1;
-    unsigned f3 : 1;
-    unsigned f4 : 1;
-    unsigned f5 : 1;
-    unsigned f6 : 1;
-    unsigned f7 : 1;
-    unsigned f8 : 1;
-    unsigned f9 : 1;
-    unsigned f10 : 1;
-    unsigned f11 : 1;
-    unsigned f12 : 1;
-    unsigned f13 : 1;
-    unsigned f14 : 1;
-    unsigned f15 : 1;
-    unsigned f16 : 1;
-    unsigned f17 : 1;
-    unsigned f18 : 1;
-    unsigned f19 : 1;
-    unsigned f20 : 1;
-    unsigned f21 : 1;
-    unsigned f22 : 1;
-    unsigned f23 : 1;
-    unsigned f24 : 1;
-    unsigned f25 : 1;
-    unsigned f26 : 1;
-    unsigned f27 : 1;
-    unsigned f28 : 1;
-    unsigned f29 : 1;
-    unsigned f30 : 1;
-    unsigned f31 : 1;
+  unsigned f0 : 1;
+  unsigned f1 : 1;
+  unsigned f2 : 1;
+  unsigned f3 : 1;
+  unsigned f4 : 1;
+  unsigned f5 : 1;
+  unsigned f6 : 1;
+  unsigned f7 : 1;
+  unsigned f8 : 1;
+  unsigned f9 : 1;
+  unsigned f10 : 1;
+  unsigned f11 : 1;
+  unsigned f12 : 1;
+  unsigned f13 : 1;
+  unsigned f14 : 1;
+  unsigned f15 : 1;
+  unsigned f16 : 1;
+  unsigned f17 : 1;
+  unsigned f18 : 1;
+  unsigned f19 : 1;
+  unsigned f20 : 1;
+  unsigned f21 : 1;
+  unsigned f22 : 1;
+  unsigned f23 : 1;
+  unsigned f24 : 1;
+  unsigned f25 : 1;
+  unsigned f26 : 1;
+  unsigned f27 : 1;
+  unsigned f28 : 1;
+  unsigned f29 : 1;
+  unsigned f30 : 1;
+  unsigned f31 : 1;
 } slot_1_bit;
 
 typedef struct
 {
-    unsigned f0 : 2;
-    unsigned f1 : 2;
-    unsigned f2 : 2;
-    unsigned f3 : 2;
-    unsigned f4 : 2;
-    unsigned f5 : 2;
-    unsigned f6 : 2;
-    unsigned f7 : 2;
-    unsigned f8 : 2;
-    unsigned f9 : 2;
-    unsigned f10 : 2;
-    unsigned f11 : 2;
-    unsigned f12 : 2;
-    unsigned f13 : 2;
-    unsigned f14 : 2;
-    unsigned f15 : 2;
+  unsigned f0 : 2;
+  unsigned f1 : 2;
+  unsigned f2 : 2;
+  unsigned f3 : 2;
+  unsigned f4 : 2;
+  unsigned f5 : 2;
+  unsigned f6 : 2;
+  unsigned f7 : 2;
+  unsigned f8 : 2;
+  unsigned f9 : 2;
+  unsigned f10 : 2;
+  unsigned f11 : 2;
+  unsigned f12 : 2;
+  unsigned f13 : 2;
+  unsigned f14 : 2;
+  unsigned f15 : 2;
 } slot_2_bit;
 
 typedef struct
 {
-    unsigned f0 : 4;
-    unsigned f1 : 4;
-    unsigned f2 : 4;
-    unsigned f3 : 4;
-    unsigned f4 : 4;
-    unsigned f5 : 4;
-    unsigned f6 : 4;
-    unsigned f7 : 4;
+  unsigned f0 : 4;
+  unsigned f1 : 4;
+  unsigned f2 : 4;
+  unsigned f3 : 4;
+  unsigned f4 : 4;
+  unsigned f5 : 4;
+  unsigned f6 : 4;
+  unsigned f7 : 4;
 } slot_4_bit;
 
 typedef struct
 {
-    unsigned f0 : 8;
-    unsigned f1 : 8;
-    unsigned f2 : 8;
-    unsigned f3 : 8;
+  unsigned f0 : 8;
+  unsigned f1 : 8;
+  unsigned f2 : 8;
+  unsigned f3 : 8;
 } slot_8_bit;
 
 typedef Union_Id slot_32_bit;
 
 typedef union
 {
-    slot_1_bit slot_1;
-    slot_2_bit slot_2;
-    slot_4_bit slot_4;
-    slot_8_bit slot_8;
-    slot_32_bit slot_32;
-} slot;
-
-// Slots are 32 bits (???for now, but we might want to make that 64).
-// The first bootstrap stage uses -std=gnu++98, so we can't use
-// static_assert in that case.
+  slot_1_bit slot_1;
+  slot_2_bit slot_2;
+  slot_4_bit slot_4;
+  slot_8_bit slot_8;
+  slot_32_bit slot_32;
+} any_slot;
+
+/* Slots are 32 bits (for now, but we might want to make that 64).
+   The first bootstrap stage uses -std=gnu++98, so we cannot use
+   static_assert in that case.  */
 #if __cplusplus >= 201402L
-static_assert(sizeof(slot_1_bit) == 4);
-static_assert(sizeof(slot_2_bit) == 4);
-static_assert(sizeof(slot_4_bit) == 4);
-static_assert(sizeof(slot_8_bit) == 4);
-static_assert(sizeof(slot_32_bit) == 4);
-static_assert(sizeof(slot) == 4);
+static_assert (sizeof (slot_1_bit) == 4);
+static_assert (sizeof (slot_2_bit) == 4);
+static_assert (sizeof (slot_4_bit) == 4);
+static_assert (sizeof (slot_8_bit) == 4);
+static_assert (sizeof (slot_32_bit) == 4);
+static_assert (sizeof (any_slot) == 4);
 #endif
+
+/* Definitions of Reason codes for Raise_xxx_Error nodes.  */
+enum RT_Exception_Code
+{
+  CE_Access_Check_Failed            = 0,
+  CE_Access_Parameter_Is_Null       = 1,
+  CE_Discriminant_Check_Failed      = 2,
+  CE_Divide_By_Zero                 = 3,
+  CE_Explicit_Raise                 = 4,
+  CE_Index_Check_Failed             = 5,
+  CE_Invalid_Data                   = 6,
+  CE_Length_Check_Failed            = 7,
+  CE_Null_Exception_Id              = 8,
+  CE_Null_Not_Allowed               = 9,
+
+  CE_Overflow_Check_Failed          = 10,
+  CE_Partition_Check_Failed         = 11,
+  CE_Range_Check_Failed             = 12,
+  CE_Tag_Check_Failed               = 13,
+  PE_Access_Before_Elaboratio       = 14,
+  PE_Accessibility_Check_Failed     = 15,
+  PE_Address_Of_Intrinsic           = 16,
+  PE_Aliased_Parameters             = 17,
+  PE_All_Guards_Closed              = 18,
+  PE_Bad_Predicated_Generic_Type    = 19,
+
+  PE_Current_Task_In_Entry_Body     = 20,
+  PE_Duplicated_Entry_Address       = 21,
+  PE_Explicit_Raise                 = 22,
+  PE_Finalize_Raised_Exception      = 23,
+  PE_Implicit_Return                = 24,
+  PE_Misaligned_Address_Value       = 25,
+  PE_Missing_Return                 = 26,
+  PE_Overlaid_Controlled_Object     = 27,
+  PE_Potentially_Blocking_Operation = 28,
+  PE_Stubbed_Subprogram_Called      = 29,
+
+  PE_Unchecked_Union_Restriction    = 30,
+  PE_Non_Transportable_Actual       = 31,
+  SE_Empty_Storage_Pool             = 32,
+  SE_Explicit_Raise                 = 33,
+  SE_Infinite_Recursion             = 34,
+  SE_Object_Too_Large               = 35,
+  PE_Stream_Operation_Not_Allowed   = 36,
+  PE_Build_In_Place_Mismatch        = 37
+};
+
+#define LAST_REASON_CODE 37


diff --git a/gcc/ada/uintp.ads b/gcc/ada/uintp.ads
--- a/gcc/ada/uintp.ads
+++ b/gcc/ada/uintp.ads
@@ -531,10 +531,10 @@  private
    --  used for converting from one to the other are defined.
 
    type Uint_Entry is record
-      Length : Pos;
+      Length : aliased Pos;
       --  Length of entry in Udigits table in digits (i.e. in words)
 
-      Loc : Int;
+      Loc : aliased Int;
       --  Starting location in Udigits table of this Uint value
    end record;
 


diff --git a/gcc/ada/uintp.h b/gcc/ada/uintp.h
--- a/gcc/ada/uintp.h
+++ b/gcc/ada/uintp.h
@@ -99,14 +99,13 @@  extern Boolean UI_Lt			(Uint, Uint);
 
    For efficiency, this method is used only for integer values larger than the
    constant Uint_Bias.  If a Uint is less than this constant, then it contains
-   the integer value itself.  The origin of the Uints_Ptr table is adjusted so
-   that a Uint value of Uint_Bias indexes the first element.  */
+   the integer value itself.  */
 
-#define Uints_Ptr (uintp__uints__table - Uint_Table_Start)
-extern struct Uint_Entry *uintp__uints__table;
+#define Uints_Ptr uintp__uints__table
+extern struct Uint_Entry (*Uints_Ptr)[];
 
 #define Udigits_Ptr uintp__udigits__table
-extern int *uintp__udigits__table;
+extern int (*Udigits_Ptr)[];
 
 #ifdef __cplusplus
 }