diff mbox

[Ada] Check matching Float_Representation on OpenVMS

Message ID 20111223093707.GA2744@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Dec. 23, 2011, 9:37 a.m. UTC
On OpenVMS targets, a configuration pragma Float_Representation
indicates that the specified representation (IEEE, VAX) should
be the default for predefined floating point types and for
new floating point definitions.

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-12-23  Geert Bosch  <bosch@adacore.com>

	* sem_ch3.adb (Can_Derive_From): Check matching Float_Rep on VMS.
diff mbox

Patch

Index: sem_ch3.adb
===================================================================
--- sem_ch3.adb	(revision 182654)
+++ sem_ch3.adb	(working copy)
@@ -15333,10 +15333,23 @@ 
          Spec : constant Entity_Id := Real_Range_Specification (Def);
 
       begin
+         --  Check specified "digits" constraint
+
          if Digs_Val > Digits_Value (E) then
             return False;
          end if;
 
+         --  Avoid types not matching pragma Float_Representation, if present
+
+         if (Opt.Float_Format = 'I' and then Float_Rep (E) /= IEEE_Binary)
+              or else
+            (Opt.Float_Format = 'V' and then Float_Rep (E) /= VAX_Native)
+         then
+            return False;
+         end if;
+
+         --  Check for matching range, if specified
+
          if Present (Spec) then
             if Expr_Value_R (Type_Low_Bound (E)) >
                Expr_Value_R (Low_Bound (Spec))