summaryrefslogtreecommitdiffstats
path: root/gcc/ada/sem_res.adb
diff options
context:
space:
mode:
authorsam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-07 16:10:50 +0000
committersam <sam@138bc75d-0d04-0410-961f-82ee72b054a4>2008-06-07 16:10:50 +0000
commit09066160c7184c030528e4ff559b66a4ccdcb9a5 (patch)
tree0e35d02f3c3abeff9f6bae58cc6b8c07f2f35293 /gcc/ada/sem_res.adb
parent8ee8eae73d64125b00ca568011622fd64d393b25 (diff)
downloadppe42-gcc-09066160c7184c030528e4ff559b66a4ccdcb9a5.tar.gz
ppe42-gcc-09066160c7184c030528e4ff559b66a4ccdcb9a5.zip
gcc/ada/
* sem_res.adb (Large_Storage_Type): A type is large if it requires as many bits as Positive to store its values and its bounds are known at compile time. * sem_ch13.adb (Minimum_Size): Note that this function returns 0 if the size is not known at compile time. gcc/testsuite/ * gnat.dg/specs/oversize.ads: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@136532 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_res.adb')
-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 80010871910..a6d42f73637 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -56,6 +56,7 @@ with Sem_Cat; use Sem_Cat;
with Sem_Ch4; use Sem_Ch4;
with Sem_Ch6; use Sem_Ch6;
with Sem_Ch8; use Sem_Ch8;
+with Sem_Ch13; use Sem_Ch13;
with Sem_Disp; use Sem_Disp;
with Sem_Dist; use Sem_Dist;
with Sem_Elab; use Sem_Elab;
@@ -471,12 +472,15 @@ package body Sem_Res is
function Large_Storage_Type (T : Entity_Id) return Boolean is
begin
- return
- T = Standard_Integer
- or else
- T = Standard_Positive
- or else
- T = Standard_Natural;
+ -- The type is considered large if its bounds are known at
+ -- compile time and if it requires at least as many bits as
+ -- a Positive to store the possible values.
+
+ return Compile_Time_Known_Value (Type_Low_Bound (T))
+ and then Compile_Time_Known_Value (Type_High_Bound (T))
+ and then
+ Minimum_Size (T, Biased => True) >=
+ Esize (Standard_Integer) - 1;
end Large_Storage_Type;
begin
OpenPOWER on IntegriCloud