public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/33108]  New: unformatted string write errors with End of record.
@ 2007-08-18 17:30 dagurasu15 at hotmail dot com
  2007-08-18 17:42 ` [Bug fortran/33108] " jvdelisle at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: dagurasu15 at hotmail dot com @ 2007-08-18 17:30 UTC (permalink / raw)
  To: gcc-bugs

program writebug
       character*40 string1
       character*40 string2
       write(string1,*)string2
       end

compiled with no options with gfortran this results in:

At line 4 of file test.f
Fortran runtime error: End of record

Either increasing the size of string1 to 41 or using a formatted write fixes
the problem.  This smells like null termination issue maybe?  Fortran isn't
supposed to leave space for null characters though.  Anyway, this same code
works fine with f77 in gcc 3.4.4.


-- 
           Summary: unformatted string write errors with End of record.
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dagurasu15 at hotmail dot com
  GCC host triplet: P4


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


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

* [Bug fortran/33108] unformatted string write errors with End of record.
  2007-08-18 17:30 [Bug fortran/33108] New: unformatted string write errors with End of record dagurasu15 at hotmail dot com
@ 2007-08-18 17:42 ` jvdelisle at gcc dot gnu dot org
  2007-08-18 17:48 ` dagurasu15 at hotmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2007-08-18 17:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jvdelisle at gcc dot gnu dot org  2007-08-18 17:42 -------
When using list directed formatting, the default for a string appends a " "
(space) in front of the output.  If you replace * with '(a)' you will see that
it is fine. Why the others accept it, I don't know.

One question then:  Is the leading space to be omitted when writing to an
internal string?

I will check the standard on this.


-- 

jvdelisle at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |jvdelisle at gcc dot gnu dot
                   |dot org                     |org
             Status|UNCONFIRMED                 |ASSIGNED
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-08-18 17:42:34
               date|                            |


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


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

* [Bug fortran/33108] unformatted string write errors with End of record.
  2007-08-18 17:30 [Bug fortran/33108] New: unformatted string write errors with End of record dagurasu15 at hotmail dot com
  2007-08-18 17:42 ` [Bug fortran/33108] " jvdelisle at gcc dot gnu dot org
@ 2007-08-18 17:48 ` dagurasu15 at hotmail dot com
  2007-08-18 17:56 ` dagurasu15 at hotmail dot com
  2007-08-18 17:58 ` dagurasu15 at hotmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: dagurasu15 at hotmail dot com @ 2007-08-18 17:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from dagurasu15 at hotmail dot com  2007-08-18 17:48 -------
OK, I don't remember these spaces but you may be right.  Also, thinking about
it, g77 doesn't detect these types of runtime errors well, maybe it didn't
really work.  Let me rerun with some print statements on the old compiler and
post back how that worked.  This could indeed be user error.


-- 


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


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

* [Bug fortran/33108] unformatted string write errors with End of record.
  2007-08-18 17:30 [Bug fortran/33108] New: unformatted string write errors with End of record dagurasu15 at hotmail dot com
  2007-08-18 17:42 ` [Bug fortran/33108] " jvdelisle at gcc dot gnu dot org
  2007-08-18 17:48 ` dagurasu15 at hotmail dot com
@ 2007-08-18 17:56 ` dagurasu15 at hotmail dot com
  2007-08-18 17:58 ` dagurasu15 at hotmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: dagurasu15 at hotmail dot com @ 2007-08-18 17:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dagurasu15 at hotmail dot com  2007-08-18 17:55 -------

As it turns out (not surprisingly), you are correct.  It never did work, just
the old compiler didn't catch the runtime error.  I usually use a left justify
routine on my strings in the end so I never noticed the space or the array
overwrite.  So this it turns out is indeed a feature, and a good one, not a
bug.  Sorry for the noise.  Thanks.


-- 


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


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

* [Bug fortran/33108] unformatted string write errors with End of record.
  2007-08-18 17:30 [Bug fortran/33108] New: unformatted string write errors with End of record dagurasu15 at hotmail dot com
                   ` (2 preceding siblings ...)
  2007-08-18 17:56 ` dagurasu15 at hotmail dot com
@ 2007-08-18 17:58 ` dagurasu15 at hotmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: dagurasu15 at hotmail dot com @ 2007-08-18 17:58 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from dagurasu15 at hotmail dot com  2007-08-18 17:58 -------
marking as invalid


-- 

dagurasu15 at hotmail dot com changed:

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


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


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

end of thread, other threads:[~2007-08-18 17:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-18 17:30 [Bug fortran/33108] New: unformatted string write errors with End of record dagurasu15 at hotmail dot com
2007-08-18 17:42 ` [Bug fortran/33108] " jvdelisle at gcc dot gnu dot org
2007-08-18 17:48 ` dagurasu15 at hotmail dot com
2007-08-18 17:56 ` dagurasu15 at hotmail dot com
2007-08-18 17:58 ` dagurasu15 at hotmail dot com

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