public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/14717] New: Ada.Sequential_IO.Read does not work for indefinite arrays.
@ 2004-03-24 15:13 krischik at users dot sourceforge dot net
  2004-03-24 15:23 ` [Bug ada/14717] " krischik at users dot sourceforge dot net
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: krischik at users dot sourceforge dot net @ 2004-03-24 15:13 UTC (permalink / raw)
  To: gcc-bugs

Hello,

As I said Ada.Sequential_IO.Read will not work for indefinite arrays. Look a 
line 165 ff:

      if not Element_Type'Definite
        or else Element_Type'Has_Discriminants
      then
         FIO.Read_Buf
           (AP (File), Rsiz'Address, size_t'Size / System.Storage_Unit);

If

-- 
           Summary: Ada.Sequential_IO.Read does not work for indefinite
                    arrays.
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: krischik at users dot sourceforge dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14717


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug ada/14717] Ada.Sequential_IO.Read does not work for indefinite arrays.
  2004-03-24 15:13 [Bug ada/14717] New: Ada.Sequential_IO.Read does not work for indefinite arrays krischik at users dot sourceforge dot net
@ 2004-03-24 15:23 ` krischik at users dot sourceforge dot net
  2004-03-24 15:42 ` krischik at users dot sourceforge dot net
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: krischik at users dot sourceforge dot net @ 2004-03-24 15:23 UTC (permalink / raw)
  To: gcc-bugs


------- 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug ada/14717] Ada.Sequential_IO.Read does not work for indefinite arrays.
  2004-03-24 15:13 [Bug ada/14717] New: Ada.Sequential_IO.Read does not work for indefinite arrays krischik at users dot sourceforge dot net
  2004-03-24 15:23 ` [Bug ada/14717] " krischik at users dot sourceforge dot net
@ 2004-03-24 15:42 ` krischik at users dot sourceforge dot net
  2004-04-03  8:17 ` krischik at users dot sourceforge dot net
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: krischik at users dot sourceforge dot net @ 2004-03-24 15:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From krischik at users dot sourceforge dot net  2004-03-24 15:42 -------
Created an attachment (id=5989)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5989&action=view)
Fixed version

This version does the trick. The changes apply to indefinite object without
dircriminants.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14717


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug ada/14717] Ada.Sequential_IO.Read does not work for indefinite arrays.
  2004-03-24 15:13 [Bug ada/14717] New: Ada.Sequential_IO.Read does not work for indefinite arrays krischik at users dot sourceforge dot net
  2004-03-24 15:23 ` [Bug ada/14717] " krischik at users dot sourceforge dot net
  2004-03-24 15:42 ` krischik at users dot sourceforge dot net
@ 2004-04-03  8:17 ` krischik at users dot sourceforge dot net
  2004-04-03  8:30 ` charlet at act-europe dot fr
  2004-04-03 11:13 ` krischik at users dot sourceforge dot net
  4 siblings, 0 replies; 6+ messages in thread
From: krischik at users dot sourceforge dot net @ 2004-04-03  8:17 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From krischik at users dot sourceforge dot net  2004-04-03 08:17 -------
Hello,

I am going to close this bug. The reason is that Read does work for all data 
written with Write. That, of corse, means that Read is working as designed and 
the package Ada.Sequential_IO is unsuited for the task at hand.

Sad that calls for Ada 2005 is closed, otherwise I would puporse some form of 
"Ada.Unchecked_IO".

With Regards

Martin 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14717


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug ada/14717] Ada.Sequential_IO.Read does not work for indefinite arrays.
  2004-03-24 15:13 [Bug ada/14717] New: Ada.Sequential_IO.Read does not work for indefinite arrays krischik at users dot sourceforge dot net
                   ` (2 preceding siblings ...)
  2004-04-03  8:17 ` krischik at users dot sourceforge dot net
@ 2004-04-03  8:30 ` charlet at act-europe dot fr
  2004-04-03 11:13 ` krischik at users dot sourceforge dot net
  4 siblings, 0 replies; 6+ messages in thread
From: charlet at act-europe dot fr @ 2004-04-03  8:30 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From charlet at act-europe dot fr  2004-04-03 08:30 -------
Subject: Re:  Ada.Sequential_IO.Read does not work for indefinite arrays.

> Sad that calls for Ada 2005 is closed, otherwise I would puporse some form of 
> "Ada.Unchecked_IO".

You should simply use streams, that's what they are for.

Arno


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14717


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug ada/14717] Ada.Sequential_IO.Read does not work for indefinite arrays.
  2004-03-24 15:13 [Bug ada/14717] New: Ada.Sequential_IO.Read does not work for indefinite arrays krischik at users dot sourceforge dot net
                   ` (3 preceding siblings ...)
  2004-04-03  8:30 ` charlet at act-europe dot fr
@ 2004-04-03 11:13 ` krischik at users dot sourceforge dot net
  4 siblings, 0 replies; 6+ messages in thread
From: krischik at users dot sourceforge dot net @ 2004-04-03 11:13 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From krischik at users dot sourceforge dot net  2004-04-03 11:13 -------
Subject: Re:  Ada.Sequential_IO.Read does not work for indefinite arrays.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Samstag, 3. April 2004 10:30 schrieb charlet at act-europe dot fr:

Thank you for you help

> ------- Additional Comments From charlet at act-europe dot fr  2004-04-03
> 08:30 ------- Subject: Re:  Ada.Sequential_IO.Read does not work for
> indefinite arrays.
>
> > Sad that calls for Ada 2005 is closed, otherwise I would puporse some
> > form of "Ada.Unchecked_IO".

> You should simply use streams, that's what they are for.

Sometimes one is just blind. When I think of Streams I think 'Input and 
'Output. Just foregot 'Read and 'Write.

Thanks again.

With Regards

Martin
- --
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQFAbpbCijwKaHyem9cRAkpyAKCwUvymU4QnNG8+ljS+u38JSNK+1QCgrX+P
ijQxnU7jI511eWr5DsVZJBk=
=dmcJ
-----END PGP SIGNATURE-----


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14717


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-04-03 11:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-24 15:13 [Bug ada/14717] New: Ada.Sequential_IO.Read does not work for indefinite arrays krischik at users dot sourceforge dot net
2004-03-24 15:23 ` [Bug ada/14717] " krischik at users dot sourceforge dot net
2004-03-24 15:42 ` krischik at users dot sourceforge dot net
2004-04-03  8:17 ` krischik at users dot sourceforge dot net
2004-04-03  8:30 ` charlet at act-europe dot fr
2004-04-03 11:13 ` krischik at users dot sourceforge dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).