diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 9882be712e6..9d12879767e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2014-02-20 Robert Dewar + + * sem_elab.adb: Minor code reorganization (use Nkind_In). + * stringt.adb: Remove temporary pragma Warnings (Off). + * stringt.ads: Add pragma Elaborate_Body to ensure initialization + of Null_String_Id. + +2014-02-20 Matthew Heaney + + * a-chtgbk.adb (Replace): Use correct offset when calculating bucket + index. + 2014-02-20 Ed Schonberg * sem_ch5.adb (Analyze_Iterator_Specification): Initialize diff --git a/gcc/ada/a-chtgbk.adb b/gcc/ada/a-chtgbk.adb index 13082c9c25b..5f6bfa09106 100644 --- a/gcc/ada/a-chtgbk.adb +++ b/gcc/ada/a-chtgbk.adb @@ -275,6 +275,13 @@ package body Ada.Containers.Hash_Tables.Generic_Bounded_Keys is -- Per AI05-0022, the container implementation is required to detect -- element tampering by a generic actual subprogram. + -- The following block appears to be vestigial -- this should be done + -- using Checked_Index instead. Also, we might have to move the actual + -- tampering checks to the top of the subprogram, in order to prevent + -- infinite recursion when calling Hash. (This is similar to how Insert + -- and Delete are implemented.) This implies that we will have to defer + -- the computation of New_Index until after the tampering check. ??? + declare B : Natural renames HT.Busy; L : Natural renames HT.Lock; @@ -282,7 +289,7 @@ package body Ada.Containers.Hash_Tables.Generic_Bounded_Keys is B := B + 1; L := L + 1; - Old_Indx := Hash (NN (Node)) mod HT.Buckets'Length; + Old_Indx := HT.Buckets'First + Hash (NN (Node)) mod HT.Buckets'Length; B := B - 1; L := L - 1; diff --git a/gcc/ada/sem_elab.adb b/gcc/ada/sem_elab.adb index 5ab711d5233..9b8a3b2464e 100644 --- a/gcc/ada/sem_elab.adb +++ b/gcc/ada/sem_elab.adb @@ -1553,11 +1553,9 @@ package body Sem_Elab is -- then there is nothing to do (we do not know what is being assigned), -- but otherwise this is an assignment to the prefix. - if Nkind (N) = N_Indexed_Component - or else - Nkind (N) = N_Selected_Component - or else - Nkind (N) = N_Slice + if Nkind_In (N, N_Indexed_Component, + N_Selected_Component, + N_Slice) then if not Is_Access_Type (Etype (Prefix (N))) then Check_Elab_Assign (Prefix (N)); diff --git a/gcc/ada/stringt.adb b/gcc/ada/stringt.adb index 62a4dd51819..6afba04f3de 100644 --- a/gcc/ada/stringt.adb +++ b/gcc/ada/stringt.adb @@ -474,8 +474,6 @@ package body Stringt is -- Setup the null string -pragma Warnings (Off); -- kill strange warning from code below ??? - begin Start_String; Null_String_Id := End_String; diff --git a/gcc/ada/stringt.ads b/gcc/ada/stringt.ads index 864690dcdee..92b74e2c049 100644 --- a/gcc/ada/stringt.ads +++ b/gcc/ada/stringt.ads @@ -33,6 +33,8 @@ with System; use System; with Types; use Types; package Stringt is + pragma Elaborate_Body; + -- This is to make sure Null_String_Id is properly initialized -- This package contains routines for handling the strings table which is -- used to store string constants encountered in the source, and also those