summaryrefslogtreecommitdiff
path: root/gcc/ada/freeze.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-17 16:06:57 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2006-02-17 16:06:57 +0000
commitd251bf503c380e6bcf7ac566b71ba7052b6952e3 (patch)
tree79c3f38e39064cc602b2d0cc4cb3127357149c7a /gcc/ada/freeze.adb
parent7a23ebc751b91766d4e8dc512381b264244f09a8 (diff)
downloadgcc-d251bf503c380e6bcf7ac566b71ba7052b6952e3.tar.gz
2006-02-17 Ed Schonberg <schonberg@adacore.com>
* freeze.adb (Statically_Discriminated_Components): Return false if the bounds of the type of the discriminant are not static expressions. * sem_aggr.adb (Check_Static_Discriminated_Subtype): Return false if the bounds of the discriminant type are not static. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111187 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/freeze.adb')
-rw-r--r--gcc/ada/freeze.adb19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 09363af823e..da997c0dac6 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -887,12 +887,31 @@ package body Freeze is
(T : Entity_Id) return Boolean
is
Constraint : Elmt_Id;
+ Discr : Entity_Id;
begin
if Has_Discriminants (T)
and then Present (Discriminant_Constraint (T))
and then Present (First_Component (T))
then
+ Discr := First_Discriminant (T);
+
+ if Is_Access_Type (Etype (Discr)) then
+ null;
+
+ -- If the bounds of the discriminant are not compile-time known,
+ -- treat this as non-static, even if the value of the discriminant
+ -- is compile-time known, because the back-end treats aggregates
+ -- of such a subtype as having unknown size.
+
+ elsif not
+ (Compile_Time_Known_Value (Type_Low_Bound (Etype (Discr)))
+ and then
+ Compile_Time_Known_Value (Type_High_Bound (Etype (Discr))))
+ then
+ return False;
+ end if;
+
Constraint := First_Elmt (Discriminant_Constraint (T));
while Present (Constraint) loop
if not Compile_Time_Known_Value (Node (Constraint)) then