diff options
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r-- | gcc/ada/sem_attr.adb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index 480e9a62c8e..5efa6896370 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -5260,6 +5260,9 @@ package body Sem_Attr is -- Computes the Fore value for the current attribute prefix, which is -- known to be a static fixed-point type. Used by Fore and Width. + function Is_VAX_Float (Typ : Entity_Id) return Boolean; + -- Determine whether Typ denotes a VAX floating point type + function Mantissa return Uint; -- Returns the Mantissa value for the prefix type @@ -5390,6 +5393,19 @@ package body Sem_Attr is return R; end Fore_Value; + ------------------ + -- Is_VAX_Float -- + ------------------ + + function Is_VAX_Float (Typ : Entity_Id) return Boolean is + begin + return + Is_Floating_Point_Type (Typ) + and then + (Float_Format = 'V' + or else Float_Rep (Typ) = VAX_Native); + end Is_VAX_Float; + -------------- -- Mantissa -- -------------- @@ -6337,6 +6353,16 @@ package body Sem_Attr is Fold_Uint (N, Expr_Value (Lo_Bound), Static); end if; + -- Replace VAX Float_Type'First with a reference to the temporary + -- which represents the low bound of the type. This transformation + -- is needed since the back end cannot evaluate 'First on VAX. + + elsif Is_VAX_Float (P_Type) + and then Nkind (Lo_Bound) = N_Identifier + then + Rewrite (N, New_Reference_To (Entity (Lo_Bound), Sloc (N))); + Analyze (N); + else Check_Concurrent_Discriminant (Lo_Bound); end if; @@ -6528,6 +6554,16 @@ package body Sem_Attr is Fold_Uint (N, Expr_Value (Hi_Bound), Static); end if; + -- Replace VAX Float_Type'Last with a reference to the temporary + -- which represents the high bound of the type. This transformation + -- is needed since the back end cannot evaluate 'Last on VAX. + + elsif Is_VAX_Float (P_Type) + and then Nkind (Hi_Bound) = N_Identifier + then + Rewrite (N, New_Reference_To (Entity (Hi_Bound), Sloc (N))); + Analyze (N); + else Check_Concurrent_Discriminant (Hi_Bound); end if; |