This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/14717] Ada.Sequential_IO.Read does not work for indefinite arrays.
- From: "krischik at users dot sourceforge dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Mar 2004 15:23:43 -0000
- Subject: [Bug ada/14717] Ada.Sequential_IO.Read does not work for indefinite arrays.
- References: <20040324151311.14717.krischik@users.sourceforge.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From krischik at users dot sourceforge dot net 2004-03-24 15:23 -------
(sorry hit the commit button to early)
If the Element_Type is indefinite a size_t is read from the stream. However, no
size in the stream.
Later on (line 224 ff) the faulty size is compared with size of the array:
if not Element_Type'Has_Discriminants and then Rsiz > Siz then
raise Program_Error;
end if;
This again is not needed. BTW: Read A.8.3(4) - Should that not be Data_Error?!
Background: I try to read a String of a given size from STANDART_INPUT:
package S_IO
is new
Ada.Sequential_IO (
Element_Type => String);
package S_IO_C
is new
S_IO.C_Streams;
Raw_Data_Lenght : constant Natural
:= CGI_M.Get_Content_Length (Meta);
Raw_Data_String : String (1 .. Raw_Data_Lenght);
File : S_IO.File_Type;
begin
S_IO_C.Open (
File => File,
Mode => S_IO.In_File,
C_Stream => Interfaces.C_Streams.stdin,
Form => "",
Name => "");
S_IO.Read (
File => File,
Item => Raw_Data_String);
Before you ask: Text_IO does CR/LF magic and won't do.
With Regads
Martin
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14717