This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] fix handling of 'valid on 64bit platforms


Manually tested on x86_64-linux and ia64-linux.
Tested on i686-linux. Committed on mainline.

Fix handling of 'Valid attribute for long long float on AMD64 and IA64.

Test case should output:
+0.0   TRUE
-0.0   TRUE
Pi     TRUE
Inf    FALSE
NaN    FALSE
'First TRUE
'Last  TRUE
'Small TRUE
Denorm TRUE
--
with Ada.Unchecked_Conversion;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Numerics;

procedure T is
    type Unsigned_32 is mod 2**32;
    for Unsigned_32'Size use 32;

    type T is new Long_Long_Float;

    type A is array (0 .. (T'Size - 1) / 32) of Unsigned_32;
    function To_T is new Ada.Unchecked_Conversion (A, T);

    Zero       : constant T := To_T ((others => 0));
    Minus_Zero : constant T := -Zero;
    Inf        : constant T := 1.0 / Zero;
    NaN        : constant T := Zero / Zero;
    Pi         : constant T := Ada.Numerics.Pi;
    Last       : constant T := T'Last;
    First      : constant T := T'First;
    Small      : constant T := T'Small;
    Denorm     : constant T := T'Small / 8.0;

begin
    Put ("+0.0   ");
    Put_Line (Boolean'Image (Zero'Valid));

    Put ("-0.0   ");
    Put_Line (Boolean'Image (Minus_Zero'Valid));

    Put ("Pi     ");
    Put_Line (Boolean'Image (Pi'Valid));

    Put ("Inf    ");
    Put_Line (Boolean'Image (Inf'Valid));

    Put ("NaN    ");
    Put_Line (Boolean'Image (NaN'Valid));

    Put ("'First ");
    Put_Line (Boolean'Image (First'Valid));

    Put ("'Last  ");
    Put_Line (Boolean'Image (Last'Valid));

    Put ("'Small ");
    Put_Line (Boolean'Image (Small'Valid));

    Put ("Denorm ");
    Put_Line (Boolean'Image (Denorm'Valid));
end T;

2005-03-08  Geert Bosch  <bosch@adacore.com>

	* s-fatgen.adb (Valid): Extend special exceptions to account for long
	long float padding to also cover AMD64 and IA64.

Attachment: difs.29
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]