diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7116d1d0a81..4997791b118 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,24 @@ +2016-05-02 Jerome Lambourg + + * s-unstyp.ads: Code cleanups. + +2016-05-02 Hristian Kirtchev + + * sem_ch13.adb (Size_Too_Small_Error): Fix the error message format. + +2016-05-02 Ed Schonberg + + * exp_prag.adb (Expand_attributes_In_Consequence, + Expand_Attributes): If the prefix of'Old is an unconstrained type, + for example an unconstrained formal of the enclosing subprogram, + create an object declaration with an expression to obtain the + actual subtype of the temporary. + +2016-05-02 Arnaud Charlet + + * comperr.adb (Delete_SCIL_Files): Add missing handling of + N_Subprogram_Declaration. + 2016-05-02 Gary Dismukes * exp_ch5.adb, exp_ch7.adb, exp_ch7.ads, checks.adb, sem_attr.adb, diff --git a/gcc/ada/comperr.adb b/gcc/ada/comperr.adb index f32db3267b8..7838cc49948 100644 --- a/gcc/ada/comperr.adb +++ b/gcc/ada/comperr.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2016, 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- -- @@ -467,7 +467,8 @@ package body Comperr is Main := Unit (Cunit (Main_Unit)); case Nkind (Main) is - when N_Subprogram_Body | N_Package_Declaration => + when N_Subprogram_Declaration | N_Subprogram_Body | + N_Package_Declaration => Unit_Name := Defining_Unit_Name (Specification (Main)); when N_Package_Body => diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb index 5df49eef1f5..ac1aa8c24f0 100644 --- a/gcc/ada/exp_prag.adb +++ b/gcc/ada/exp_prag.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2016, 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- -- @@ -874,20 +874,33 @@ package body Exp_Prag is -- the precondition procedure that follows. Prepend_To (Decls, Decl); - Analyze (Decl); - -- Evaluate the prefix, generate: - -- Temp := ; + -- If the type is unconstrained, the prefix provides its + -- value and constraint, so add it to declaration. + + if not Is_Constrained (Etype (Pref)) + and then Is_Entity_Name (Pref) + then + Set_Expression (Decl, Pref); + Analyze (Decl); + + -- Otherwise add an assignment statement to temporary + -- using prefix as RHS. + + else + Analyze (Decl); + + if No (Eval_Stmts) then + Eval_Stmts := New_List; + end if; + + Append_To (Eval_Stmts, + Make_Assignment_Statement (Loc, + Name => New_Occurrence_Of (Temp, Loc), + Expression => Pref)); - if No (Eval_Stmts) then - Eval_Stmts := New_List; end if; - Append_To (Eval_Stmts, - Make_Assignment_Statement (Loc, - Name => New_Occurrence_Of (Temp, Loc), - Expression => Pref)); - -- Ensure that the prefix is valid if Validity_Checks_On and then Validity_Check_Operands then diff --git a/gcc/ada/s-unstyp.ads b/gcc/ada/s-unstyp.ads index 9a02704485d..f9ad3853a0a 100644 --- a/gcc/ada/s-unstyp.ads +++ b/gcc/ada/s-unstyp.ads @@ -60,6 +60,7 @@ package System.Unsigned_Types is type Packed_Bytes1 is array (Natural range <>) of aliased Packed_Byte; for Packed_Bytes1'Alignment use 1; for Packed_Bytes1'Component_Size use Packed_Byte'Size; + pragma Suppress_Initialization (Packed_Bytes1); -- This is the type used to implement packed arrays where no alignment -- is required. This includes the cases of 1,2,4 (where we use direct -- masking operations), and all odd component sizes (where the clusters @@ -68,6 +69,7 @@ package System.Unsigned_Types is type Packed_Bytes2 is new Packed_Bytes1; for Packed_Bytes2'Alignment use Integer'Min (2, Standard'Maximum_Alignment); + pragma Suppress_Initialization (Packed_Bytes2); -- This is the type used to implement packed arrays where an alignment -- of 2 (is possible) is helpful for maximum efficiency of the get and -- set routines in the corresponding library unit. This is true of all @@ -78,6 +80,7 @@ package System.Unsigned_Types is type Packed_Bytes4 is new Packed_Bytes1; for Packed_Bytes4'Alignment use Integer'Min (4, Standard'Maximum_Alignment); + pragma Suppress_Initialization (Packed_Bytes4); -- This is the type used to implement packed arrays where an alignment -- of 4 (if possible) is helpful for maximum efficiency of the get and -- set routines in the corresponding library unit. This is true of all diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 2354cde9e01..589c0a1a2f6 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -10906,7 +10906,7 @@ package body Sem_Ch13 is if not ASIS_Mode then Error_Msg_Uint_1 := Min_Siz; - Error_Msg_NE ("size for & too small, minimum allowed is ^", N, T); + Error_Msg_NE ("size for& too small, minimum allowed is ^", N, T); end if; end Size_Too_Small_Error;