From 7028ce0d3916755b930332f6796f3c0911ae04e8 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 6 Nov 2012 11:05:10 +0100 Subject: [PATCH] [multiple changes] 2012-11-06 Tristan Gingold * exp_vfpt.adb: Document VAX float point layout. 2012-11-06 Geert Bosch * eval_fat.adb (Machine): Don't return -0.0 on targets without signed zeros. 2012-11-06 Ed Schonberg * sem_ch9.adb (Analyze_Entry_Call_Alternative, Check_Triggering_Statement): Reject properly an indirect call. From-SVN: r193222 --- gcc/ada/ChangeLog | 14 ++++++++++ gcc/ada/eval_fat.adb | 17 ++++++++---- gcc/ada/exp_vfpt.adb | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++- gcc/ada/sem_ch9.adb | 14 ++++++++++ 4 files changed, 113 insertions(+), 6 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index ea56dec..7aad4ba 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,17 @@ +2012-11-06 Tristan Gingold + + * exp_vfpt.adb: Document VAX float point layout. + +2012-11-06 Geert Bosch + + * eval_fat.adb (Machine): Don't return -0.0 on targets without + signed zeros. + +2012-11-06 Ed Schonberg + + * sem_ch9.adb (Analyze_Entry_Call_Alternative, + Check_Triggering_Statement): Reject properly an indirect call. + 2012-11-06 Pascal Obry * xoscons.adb, xutil.adb, xutil.ads: Add support for post-processing. diff --git a/gcc/ada/eval_fat.adb b/gcc/ada/eval_fat.adb index 8ebeb11..bbcb886 100644 --- a/gcc/ada/eval_fat.adb +++ b/gcc/ada/eval_fat.adb @@ -371,9 +371,14 @@ package body Eval_Fat is case Mode is when Round_Even => - -- This rounding mode should not be used for static - -- expressions, but only for compile-time evaluation of - -- non-static expressions. + -- This rounding mode corresponds to the unbiased rounding + -- method that is used at run time. When the real value is + -- exactly between two machine numbers, choose the machine + -- number with its least significant bit equal to zero. + + -- The recommendation advice in RM 4.9(38) is that static + -- expressions are rounded to machine numbers in the same + -- way as the target machine does. if (Even and then N * 2 > D) or else @@ -386,7 +391,9 @@ package body Eval_Fat is -- Do not round to even as is done with IEEE arithmetic, but -- instead round away from zero when the result is exactly - -- between two machine numbers. See RM 4.9(38). + -- between two machine numbers. This biased rounding method + -- should not be used to convert static expressions to + -- machine numbers, see AI95-268. if N * 2 >= D then Fraction := Fraction + 1; @@ -513,7 +520,7 @@ package body Eval_Fat is - Machine_Mantissa_Value (RT) + Uint_1; begin if X_Exp < Emin_Den or not Denorm_On_Target then - if UR_Is_Negative (X) then + if Signed_Zeros_On_Target and then UR_Is_Negative (X) then Error_Msg_N ("floating-point value underflows to -0.0?", Enode); return Ureal_M_0; diff --git a/gcc/ada/exp_vfpt.adb b/gcc/ada/exp_vfpt.adb index 592114c..146fab8 100644 --- a/gcc/ada/exp_vfpt.adb +++ b/gcc/ada/exp_vfpt.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1997-2010, Free Software Foundation, Inc. -- +-- Copyright (C) 1997-2012, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -37,6 +37,78 @@ with Urealp; use Urealp; package body Exp_VFpt is + -- Vax floating point format (from Vax Architecture Reference Manual + -- version 6): + -- + -- Float F: + -- -------- + -- + -- 1 1 + -- 5 4 7 6 0 + -- +-+---------------+--------------+ + -- |S| exp | fraction | A + -- +-+---------------+--------------+ + -- | fraction | A + 2 + -- +--------------------------------+ + -- + -- bit 15 is the sign bit, + -- bits 14:7 is the excess 128 binary exponent, + -- bits 6:0 and 31:16 the normalized 24-bit fraction with the redundant + -- most significant fraction bit not represented. + -- + -- An exponent value of 0 together with a sign bit of 0, is taken to + -- indicate that the datum has a value of 0. Exponent values of 1 through + -- 255 indicate true binary exponents of -127 to +127. An exponent value + -- of 0, together with a sign bit of 1, is taken as reserved. + -- + -- Note that fraction bits are not continuous in memory, VAX is little + -- endian (LSB first). + -- + -- Float D: + -- -------- + -- + -- 1 1 + -- 5 4 7 6 0 + -- +-+---------------+--------------+ + -- |S| exp | fraction | A + -- +-+---------------+--------------+ + -- | fraction | A + 2 + -- +--------------------------------+ + -- | fraction | A + 4 + -- +--------------------------------+ + -- | fraction | A + 6 + -- +--------------------------------+ + -- + -- Like Float F but with 55 bits for the fraction. + -- + -- Float G: + -- -------- + -- + -- 1 1 + -- 5 4 4 3 0 + -- +-+---------------------+--------+ + -- |S| exp | fract | A + -- +-+---------------------+--------+ + -- | fraction | A + 2 + -- +--------------------------------+ + -- | fraction | A + 4 + -- +--------------------------------+ + -- | fraction | A + 6 + -- +--------------------------------+ + -- + -- Exponent values of 1 through 2047 indicate trye binary exponents of + -- -1023 to +1023. + -- + -- Main differences compared to IEEE 754: + -- + -- * No denormalized numbers + -- * No infinity + -- * No NaN + -- * No -0.0 + -- * Reserved values (exp = 0, sign = 1) + -- * Vax mantissa represent values [0.5, 1) + -- * Bias is shifted by 1 (for single float: 128 on Vax, 127 on IEEE) + VAXFF_Digits : constant := 6; VAXDF_Digits : constant := 9; VAXGF_Digits : constant := 15; diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb index a81ea5c..4e0ecf2 100644 --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -1470,6 +1470,15 @@ package body Sem_Ch9 is Analyze (Call); + -- An indirect call in this context is illegal. A procedure call that + -- does not involve a renaming of an entry is illegal as well, but this + -- and other semantic errors are caught during resolution. + + if Nkind (Call) = N_Explicit_Dereference then + Error_Msg_N + ("entry call or dispatching primitive of interface required ", N); + end if; + if Is_Non_Empty_List (Statements (N)) then Analyze_Statements (Statements (N)); end if; @@ -3304,6 +3313,11 @@ package body Sem_Ch9 is ("dispatching operation of limited or synchronized " & "interface required (RM 9.7.2(3))!", Error_Node); end if; + + elsif Nkind (Trigger) = N_Explicit_Dereference then + Error_Msg_N + ("entry call or dispatching primitive of interface required ", + Trigger); end if; end if; end Check_Triggering_Statement; -- 2.7.4