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] |
Several routines are provided by System.Stream_Attributes for floating point types (W_SF, W_F, W_LF, W_LLF). The appropriate routine to call for an attribute reference is determined using two criteria. If a non-standard size or a stream size is specified, then we should certainly use the size. But if we have two types the same (notably Short_Float_Size = Float_Size which is close to universally true, and Long_Long_Float_Size = Long_Float_Size, true on most targets except the x86), then we would really rather use the root type, so that if people want to fiddle with System.Stream_Attributes to get inter-target portable streams, they get the size they expect. Consider in particular the case of a stream written on an x86, with 96-bit Long_Long_Float being read into a non-x86 target with 64 bit Long_Long_Float. A special version of System.Stream_Attributes can deal with this provided the proper type is always used. This change fixes an inccorect test in the circuitry that implements this selection scheme. When compiled with -gnatG, the two attribute references in the below subprogram must be expanded to calls to W_LF and I_LF, respectively. $ cat p.adb with Ada.Streams; use Ada.Streams; procedure P (S : access Root_Stream_Type'Class; FI : Long_Float; FO : out Long_Float) is begin Long_Float'Write (S, FI); Long_Float'Read (S, FO); end P; $ gcc -c -gnatG p.adb [...] $system__stream_attributes__w_lf (s, fi); fo := long_float!($system__stream_attributes__i_lf (s)); [...] Tested on i686-pc-linux-gnu, committed on trunk 2008-08-20 Thomas Quinot <quinot@adacore.com> * exp_strm.adb (Build_Elementary_Input_Call, Build_Elementary_Write_Call): Fix incorrect condition in circuitry that selects the stream attribute routines for long float types.
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |