aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/sem_ch13.ads3
-rw-r--r--gcc/ada/sem_res.adb16
3 files changed, 20 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 4a5a535..4a2da86b 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+2008-06-07 Samuel Tardieu <sam@rfc1149.net>
+
+ * 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.
+
2008-06-06 Nicolas Setton <setton@adacore.com>
Olivier Hainque <hainque@adacore.com>
diff --git a/gcc/ada/sem_ch13.ads b/gcc/ada/sem_ch13.ads
index e7c20bc..175f304 100644
--- a/gcc/ada/sem_ch13.ads
+++ b/gcc/ada/sem_ch13.ads
@@ -64,7 +64,8 @@ package Sem_Ch13 is
-- the given type, of the size the type would have if it were biased. If
-- the type is already biased, then Minimum_Size returns the biased size,
-- regardless of the setting of Biased. Also, fixed-point types are never
- -- biased in the current implementation.
+ -- biased in the current implementation. If the size is not known at
+ -- compile time, this function returns 0.
procedure Check_Constant_Address_Clause (Expr : Node_Id; U_Ent : Entity_Id);
-- Expr is an expression for an address clause. This procedure checks
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index 8001087..a6d42f7 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