public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/34565]  New: internal write to string array fails
@ 2007-12-23 11:38 burnus at gcc dot gnu dot org
  2007-12-23 17:03 ` [Bug fortran/34565] " jvdelisle at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-12-23 11:38 UTC (permalink / raw)
  To: gcc-bugs

More bugs found via the test suite

Gfortran 4.1, 4.2 and 4.3 show the run-time error:
    Fortran runtime error: End of file

implicit none
integer :: i
character(len=6) :: c (5) = ""
write (c (5:1:-2), "(I2,I2,I2)") 5,3,1
if (any(c(1:4) /= "")) stop 'ERROR 1'
if (c(5) /= " 5 3 1") stop 'ERROR 2'
do i = 1, 5
  print '(i0,3a)', i, '"',c(i),'"'
end do
end


-- 
           Summary: internal write to string array fails
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org
OtherBugsDependingO 32834
             nThis:


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


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

* [Bug fortran/34565] internal write to string array fails
  2007-12-23 11:38 [Bug fortran/34565] New: internal write to string array fails burnus at gcc dot gnu dot org
@ 2007-12-23 17:03 ` jvdelisle at gcc dot gnu dot org
  2007-12-26 14:22 ` tkoenig at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-12-23 17:03 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jvdelisle at gcc dot gnu dot org  2007-12-23 17:03 -------
I can confirm this one.  Its been a long time since I looked at this.  I seem
to recall at one point we had not implemented negative strides for internal
units.  Part of the discussion was that it was so obscure we probably did not
need to bother with it.  So it was put on back burner.  I think we should lower
the priority on this one.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4


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


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

* [Bug fortran/34565] internal write to string array fails
  2007-12-23 11:38 [Bug fortran/34565] New: internal write to string array fails burnus at gcc dot gnu dot org
  2007-12-23 17:03 ` [Bug fortran/34565] " jvdelisle at gcc dot gnu dot org
@ 2007-12-26 14:22 ` tkoenig at gcc dot gnu dot org
  2007-12-27 15:07 ` tkoenig at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-12-26 14:22 UTC (permalink / raw)
  To: gcc-bugs



-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tkoenig at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-12-26 14:22:31
               date|                            |


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


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

* [Bug fortran/34565] internal write to string array fails
  2007-12-23 11:38 [Bug fortran/34565] New: internal write to string array fails burnus at gcc dot gnu dot org
  2007-12-23 17:03 ` [Bug fortran/34565] " jvdelisle at gcc dot gnu dot org
  2007-12-26 14:22 ` tkoenig at gcc dot gnu dot org
@ 2007-12-27 15:07 ` tkoenig at gcc dot gnu dot org
  2007-12-27 15:36 ` tkoenig at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-12-27 15:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tkoenig at gcc dot gnu dot org  2007-12-27 15:07 -------
With the new transfer_array functions, this
should be fairly easy to do.

I'll take a shot at this.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |tkoenig at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-12-26 14:22:31         |2007-12-27 15:07:39
               date|                            |


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


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

* [Bug fortran/34565] internal write to string array fails
  2007-12-23 11:38 [Bug fortran/34565] New: internal write to string array fails burnus at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2007-12-27 15:07 ` tkoenig at gcc dot gnu dot org
@ 2007-12-27 15:36 ` tkoenig at gcc dot gnu dot org
  2007-12-28  1:00 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-12-27 15:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from tkoenig at gcc dot gnu dot org  2007-12-27 15:36 -------
Reduce test case:

$ cat end-2.f90
program main
  implicit none
  character(len=6) :: c (2) = ""
  write (c (2:1:-1), "(I2)") 5
end program main
$ gfortran end-2.f90
$ ./a.out
At line 4 of file end-2.f90
Fortran runtime error: End of file


-- 


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


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

* [Bug fortran/34565] internal write to string array fails
  2007-12-23 11:38 [Bug fortran/34565] New: internal write to string array fails burnus at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2007-12-27 15:36 ` tkoenig at gcc dot gnu dot org
@ 2007-12-28  1:00 ` jvdelisle at gcc dot gnu dot org
  2007-12-28 13:16 ` tkoenig at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-12-28  1:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from jvdelisle at gcc dot gnu dot org  2007-12-28 01:00 -------
The relevant code is in transfer.c (next_array_record).  You will see the TODO
in the comment.  The array descriptor should be coming in fine to the library
so this  function just needs to be updated some.

Enjoy!


-- 


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


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

* [Bug fortran/34565] internal write to string array fails
  2007-12-23 11:38 [Bug fortran/34565] New: internal write to string array fails burnus at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2007-12-28  1:00 ` jvdelisle at gcc dot gnu dot org
@ 2007-12-28 13:16 ` tkoenig at gcc dot gnu dot org
  2007-12-28 15:39 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-12-28 13:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from tkoenig at gcc dot gnu dot org  2007-12-28 13:16 -------
Created an attachment (id=14837)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14837&action=view)
partial patch

The attached patch will let the test case from comment #3
succeed, but not the original test case.


-- 


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


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

* [Bug fortran/34565] internal write to string array fails
  2007-12-23 11:38 [Bug fortran/34565] New: internal write to string array fails burnus at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2007-12-28 13:16 ` tkoenig at gcc dot gnu dot org
@ 2007-12-28 15:39 ` jvdelisle at gcc dot gnu dot org
  2008-01-03 20:11 ` tkoenig at gcc dot gnu dot org
  2008-01-03 20:12 ` tkoenig at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-12-28 15:39 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2007-12-28 15:39 -------
See in next_array_record where we do not handle negative step size other than
-1


-- 


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


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

* [Bug fortran/34565] internal write to string array fails
  2007-12-23 11:38 [Bug fortran/34565] New: internal write to string array fails burnus at gcc dot gnu dot org
                   ` (6 preceding siblings ...)
  2007-12-28 15:39 ` jvdelisle at gcc dot gnu dot org
@ 2008-01-03 20:11 ` tkoenig at gcc dot gnu dot org
  2008-01-03 20:12 ` tkoenig at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-01-03 20:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from tkoenig at gcc dot gnu dot org  2008-01-03 19:50 -------
Subject: Bug 34565

Author: tkoenig
Date: Thu Jan  3 19:49:38 2008
New Revision: 131305

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131305
Log:
2008-01-03  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR libfortran/34565
        * io/io.h:  Adjust protoypes for open_internal(),
        next_array_record() and init_loop_spec().
        * io/list_read.c (next_char):  Use argument "finished"
        of next_array_record to check for end on internal file.
        * io/unit.c:  Calculate the offset for an array
        internal file and supply this informatin to open_internal().
        * io/unix.c (open_internal):  Set the offset for the internal
        file on open.
        * io/transfer.c (init_loop_spec):  Calculate the starting
        record in case of negative strides.  Return size of 0 for
        an empty array.
        (next_array_record):  Use an extra flag to signal that the
        array is finished.
        (next_record_r):  Use the new flag to next_array_record().
        (next_record_w):  Likewise.

2008-01-03  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR libfortran/34565
        * gfortran.dg/internal_readwrite_1.f90:  New test.
        * gfortran.dg/internal_readwrite_2.f90:  New test.


Added:
    trunk/gcc/testsuite/gfortran.dg/internal_readwrite_1.f90
    trunk/gcc/testsuite/gfortran.dg/internal_readwrite_2.f90
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/io.h
    trunk/libgfortran/io/list_read.c
    trunk/libgfortran/io/transfer.c
    trunk/libgfortran/io/unit.c
    trunk/libgfortran/io/unix.c


-- 


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


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

* [Bug fortran/34565] internal write to string array fails
  2007-12-23 11:38 [Bug fortran/34565] New: internal write to string array fails burnus at gcc dot gnu dot org
                   ` (7 preceding siblings ...)
  2008-01-03 20:11 ` tkoenig at gcc dot gnu dot org
@ 2008-01-03 20:12 ` tkoenig at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2008-01-03 20:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from tkoenig at gcc dot gnu dot org  2008-01-03 19:53 -------
Fixed on trunk.

Closing.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2008-01-03 19:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-23 11:38 [Bug fortran/34565] New: internal write to string array fails burnus at gcc dot gnu dot org
2007-12-23 17:03 ` [Bug fortran/34565] " jvdelisle at gcc dot gnu dot org
2007-12-26 14:22 ` tkoenig at gcc dot gnu dot org
2007-12-27 15:07 ` tkoenig at gcc dot gnu dot org
2007-12-27 15:36 ` tkoenig at gcc dot gnu dot org
2007-12-28  1:00 ` jvdelisle at gcc dot gnu dot org
2007-12-28 13:16 ` tkoenig at gcc dot gnu dot org
2007-12-28 15:39 ` jvdelisle at gcc dot gnu dot org
2008-01-03 20:11 ` tkoenig at gcc dot gnu dot org
2008-01-03 20:12 ` tkoenig at gcc dot gnu dot org

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