summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-04 12:34:16 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-04 12:34:16 +0000
commit414e39463550fea2dc494643a41155db86def6ba (patch)
tree2c98d4773a34e951cf28404399417a3a5a4297d5
parent4b69831ad85746b8e05082d6f6ba3fdc40e1112e (diff)
downloadppe42-gcc-414e39463550fea2dc494643a41155db86def6ba.tar.gz
ppe42-gcc-414e39463550fea2dc494643a41155db86def6ba.zip
2008-08-04 Robert Dewar <dewar@adacore.com>
* sem_ch13.ads: Minor comment update * sem_res.adb: (Large_Storage_Type): Improve previous change. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138612 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/sem_res.adb16
1 files changed, 10 insertions, 6 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 6c632fdb5f7..d59c30bc0f9 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -446,16 +446,18 @@ package body Sem_Res is
return;
end if;
- -- Detect a common beginner error:
+ -- Detect a common error:
-- type R (D : Positive := 100) is record
-- Name : String (1 .. D);
-- end record;
- -- The default value causes an object of type R to be
- -- allocated with room for Positive'Last characters.
+ -- The default value causes an object of type R to be allocated
+ -- with room for Positive'Last characters. The RM does not mandate
+ -- the allocation of the maximum size, but that is what GNAT does
+ -- so we should warn the programmer that there is a problem.
- declare
+ Check_Large : declare
SI : Node_Id;
T : Entity_Id;
TB : Node_Id;
@@ -480,9 +482,11 @@ package body Sem_Res is
and then Compile_Time_Known_Value (Type_High_Bound (T))
and then
Minimum_Size (T, Biased => True) >=
- Esize (Standard_Integer) - 1;
+ RM_Size (Standard_Positive);
end Large_Storage_Type;
+ -- Start of processing for Check_Large
+
begin
-- Check that the Disc has a large range
@@ -553,7 +557,7 @@ package body Sem_Res is
<<No_Danger>>
null;
- end;
+ end Check_Large;
end if;
-- Legal case is in index or discriminant constraint
OpenPOWER on IntegriCloud