aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-05-02 12:14:23 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-05-02 12:14:23 +0200
commit331e50151c7fbc9931899d0c10fa5fed7be4f8be (patch)
tree38cd4b76c35c881b1a78a6347deba42d26f0bd0c /gcc
parent2c94bbe3c25520fa979adb7eb61b32aba6f5a1c4 (diff)
downloadgcc-331e50151c7fbc9931899d0c10fa5fed7be4f8be.zip
gcc-331e50151c7fbc9931899d0c10fa5fed7be4f8be.tar.gz
gcc-331e50151c7fbc9931899d0c10fa5fed7be4f8be.tar.bz2
[multiple changes]
2016-05-02 Jerome Lambourg <lambourg@adacore.com> * s-unstyp.ads: Code cleanups. 2016-05-02 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch13.adb (Size_Too_Small_Error): Fix the error message format. 2016-05-02 Ed Schonberg <schonberg@adacore.com> * 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 <charlet@adacore.com> * comperr.adb (Delete_SCIL_Files): Add missing handling of N_Subprogram_Declaration. From-SVN: r235738
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog21
-rw-r--r--gcc/ada/comperr.adb5
-rw-r--r--gcc/ada/exp_prag.adb35
-rw-r--r--gcc/ada/s-unstyp.ads3
-rw-r--r--gcc/ada/sem_ch13.adb2
5 files changed, 52 insertions, 14 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 7116d1d..4997791 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,24 @@
+2016-05-02 Jerome Lambourg <lambourg@adacore.com>
+
+ * s-unstyp.ads: Code cleanups.
+
+2016-05-02 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_ch13.adb (Size_Too_Small_Error): Fix the error message format.
+
+2016-05-02 Ed Schonberg <schonberg@adacore.com>
+
+ * 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 <charlet@adacore.com>
+
+ * comperr.adb (Delete_SCIL_Files): Add missing handling of
+ N_Subprogram_Declaration.
+
2016-05-02 Gary Dismukes <dismukes@adacore.com>
* 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 f32db32..7838cc4 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 5df49ee..ac1aa8c 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,19 +874,32 @@ package body Exp_Prag is
-- the precondition procedure that follows.
Prepend_To (Decls, Decl);
- Analyze (Decl);
- -- Evaluate the prefix, generate:
- -- Temp := <Pref>;
+ -- If the type is unconstrained, the prefix provides its
+ -- value and constraint, so add it to declaration.
- if No (Eval_Stmts) then
- Eval_Stmts := New_List;
- end if;
+ 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));
+ Append_To (Eval_Stmts,
+ Make_Assignment_Statement (Loc,
+ Name => New_Occurrence_Of (Temp, Loc),
+ Expression => Pref));
+
+ end if;
-- Ensure that the prefix is valid
diff --git a/gcc/ada/s-unstyp.ads b/gcc/ada/s-unstyp.ads
index 9a02704..f9ad385 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 2354cde..589c0a1 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;