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] Avoid junk validity check for OUT parameter of 'Read or 'Input


If the following program is compiled with -gnatVa and an empty file
inputfile.dat, then it should terminate with an End_Error exception:

raised ADA.IO_EXCEPTIONS.END_ERROR : s-stratt.adb:250

But before this patch, it gets a validity check, since there is a junk
validity check on the OUT parameter for the Read attribute.

pragma Initialize_Scalars;
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
procedure Tic_Read is
   Test_File   : File_Type;
   Test_Stream : Stream_Access;
   Float_Value : Long_Float;
begin
   Open (Test_File, In_File, "inputfile.dat");
   Test_Stream := Stream (Test_File);
   Long_Float'Read (Test_Stream, Float_Value);
   Close (Test_File);
end Tic_Read;

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

2008-08-22  Robert Dewar  <dewar@adacore.com>

	* exp_attr.adb:
	(Expand_N_Attribute_Reference): No validity checking on OUT parameter of
	Read or Input attribute.

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]