summaryrefslogtreecommitdiff
path: root/gcc/ada/exp_aggr.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-31 12:32:10 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2014-07-31 12:32:10 +0000
commita653c8e26e88e9e1a8a4f6a2bc6f0778e938d08f (patch)
tree665c72f50c2ecaffd57b68f62703febe25766cca /gcc/ada/exp_aggr.adb
parent05987af32749a4cbd6507adbe13428be99f1b6a6 (diff)
downloadgcc-a653c8e26e88e9e1a8a4f6a2bc6f0778e938d08f.tar.gz
2014-07-31 Vincent Celier <celier@adacore.com>
* projects.texi: Minor spelling error fix. 2014-07-31 Robert Dewar <dewar@adacore.com> * gnat_rm.texi: Document No_Elaboration_Code_All restriction. * lib-writ.adb, lib-load.adb: Initialize No_Elab_Code field in unit information. * lib.ads, lib.adb (No_Elab_Code): New field in unit information. * restrict.adb (Process_Restriction_Synonyms): Add handling of No_Elaboration_Code_All. * restrict.ads (Process_Restriction_Synonyms): Now handles No_Elaboration_Code_All. * sem_ch10.adb (Analyze_Context): Enforce transitive with for No_Elaboration_Code_All. * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings): Handle setting of No_Elab_Code in unit information. Handle No_Elaboration_Code_All. * snames.ads-tmpl (Name_No_Elaboration_Code): New name for pragma processing. (Name_No_Elaboration_Code_All): New name for pragma processing. 2014-07-31 Eric Botcazou <ebotcazou@adacore.com> * exp_aggr.adb (Aggr_Assignment_OK_For_Backend): Reject array types with a null range and use the Esize of the component instead of its RM_Size to identify appropriate values. 2014-07-31 Hristian Kirtchev <kirtchev@adacore.com> * freeze.adb Add with and use clause for Aspects. (Freeze_Expression): Emit an error when a volatile constant lacks Boolean aspect Import. (Has_Boolean_Aspect_Import): New routine. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@213347 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/exp_aggr.adb')
-rw-r--r--gcc/ada/exp_aggr.adb30
1 files changed, 23 insertions, 7 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 19debb301af..4638537a010 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -4043,9 +4043,10 @@ package body Exp_Aggr is
-- 3. The array type has no atomic components
- -- 4. The component type is discrete
+ -- 4. The array type has no null ranges (the purpose of this is to
+ -- avoid a bogus warning for an out-of-range value).
- -- 5. The component size is a multiple of Storage_Unit
+ -- 5. The component type is discrete
-- 6. The component size is Storage_Unit or the value is of the form
-- M * (1 + A**1 + A**2 + .. A**(K-1)) where A = 2**(Storage_Unit)
@@ -4057,7 +4058,10 @@ package body Exp_Aggr is
function Aggr_Assignment_OK_For_Backend (N : Node_Id) return Boolean is
Ctyp : Entity_Id;
+ Index : Entity_Id;
Expr : Node_Id := N;
+ Low : Node_Id;
+ High : Node_Id;
Remainder : Uint;
Value : Uint;
Nunits : Nat;
@@ -4081,6 +4085,17 @@ package body Exp_Aggr is
return False;
end if;
+ Index := First_Index (Ctyp);
+ while Present (Index) loop
+ Get_Index_Bounds (Index, Low, High);
+
+ if Is_Null_Range (Low, High) then
+ return False;
+ end if;
+
+ Next_Index (Index);
+ end loop;
+
Expr := Expression (First (Component_Associations (Expr)));
for J in 1 .. Number_Dimensions (Ctyp) - 1 loop
@@ -4100,9 +4115,7 @@ package body Exp_Aggr is
end if;
end loop;
- if not Is_Discrete_Type (Ctyp)
- or else RM_Size (Ctyp) mod System_Storage_Unit /= 0
- then
+ if not Is_Discrete_Type (Ctyp) then
return False;
end if;
@@ -4110,7 +4123,10 @@ package body Exp_Aggr is
Analyze_And_Resolve (Expr, Ctyp);
- Nunits := UI_To_Int (RM_Size (Ctyp) / System_Storage_Unit);
+ -- The back end uses the Esize as the precision of the type
+
+ Nunits := UI_To_Int (Esize (Ctyp)) / System_Storage_Unit;
+
if Nunits = 1 then
return True;
end if;
@@ -4125,7 +4141,7 @@ package body Exp_Aggr is
Value := Value - Expr_Value (Type_Low_Bound (Ctyp));
end if;
- -- 0 and -1 immediately satisfy the last check
+ -- Values 0 and -1 immediately satisfy the last check
if Value = Uint_0 or else Value = Uint_Minus_1 then
return True;