public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/37294]  New: Namelist I/O to array character internal units
@ 2008-08-31  0:21 jvdelisle at gcc dot gnu dot org
  2008-08-31  0:25 ` [Bug libfortran/37294] " jvdelisle at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-08-31  0:21 UTC (permalink / raw)
  To: gcc-bugs

The following illustrates this:

  character(30) :: line(3)
  namelist /stuff/ n
  n = 123
  line = ""
  write(line,nml=stuff)
  write(*,*) "1)",line(1)
  write(*,*) "2)",line(2)
  write(*,*) "3)",line(3)
  end 

$ ./a.out 
 1)&STUFF  N=        123,  /     
 2)                              
 3)                      

This is really low priority since F2003 disallows it any way. I presume the
output should be:

$ ./a.out 
 1)&STUFF
 2)N=        123,
 3)/

Any comments on validity of this?


-- 
           Summary: Namelist I/O to array character internal units
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libfortran
        AssignedTo: jvdelisle at gcc dot gnu dot org
        ReportedBy: jvdelisle at gcc dot gnu dot org


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


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

* [Bug libfortran/37294] Namelist I/O to array character internal units
  2008-08-31  0:21 [Bug libfortran/37294] New: Namelist I/O to array character internal units jvdelisle at gcc dot gnu dot org
@ 2008-08-31  0:25 ` jvdelisle at gcc dot gnu dot org
  2008-08-31  9:13 ` burnus at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-08-31  0:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jvdelisle at gcc dot gnu dot org  2008-08-31 00:24 -------
Correction. -std=f95 disallows it.


-- 


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


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

* [Bug libfortran/37294] Namelist I/O to array character internal units
  2008-08-31  0:21 [Bug libfortran/37294] New: Namelist I/O to array character internal units jvdelisle at gcc dot gnu dot org
  2008-08-31  0:25 ` [Bug libfortran/37294] " jvdelisle at gcc dot gnu dot org
@ 2008-08-31  9:13 ` burnus at gcc dot gnu dot org
  2008-11-13  6:07 ` jvdelisle at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-08-31  9:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from burnus at gcc dot gnu dot org  2008-08-31 09:11 -------
"9.3 Internal files"
"(2) A record of an internal file is a scalar character variable."
"(3) If the file is a scalar character variable, it consists of a single record
whose length is the same as the length of the scalar character variable. If the
file is a character array, it is treated as a sequence of character array
elements."

I'm not sure that one necessarily has always to write:
 1)&STUFF
 2)N=        123,
 3)/

I think NAG f95 does it standard conform and sensible:

With:  character(30) :: line(3)
 1) &STUFF N = 123/
 2)
 3)
With:   character(10) :: line(3) ! or 15
 1) &STUFF
 2) N = 123/
 3)
With:   character(9) :: line(3)
 1) &STUFF
 2) N = 123
 3) /
With:   character(8) :: line(3)
 1) &STUFF
 2) N =
 3)  123/

gfortran (and g95) print:
  Fortran runtime error: End of record
when the data does not fit into a single record/array element.

(I don't know how to decide without to many CPU cycles when to start a new
record.)


-- 


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


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

* [Bug libfortran/37294] Namelist I/O to array character internal units
  2008-08-31  0:21 [Bug libfortran/37294] New: Namelist I/O to array character internal units jvdelisle at gcc dot gnu dot org
  2008-08-31  0:25 ` [Bug libfortran/37294] " jvdelisle at gcc dot gnu dot org
  2008-08-31  9:13 ` burnus at gcc dot gnu dot org
@ 2008-11-13  6:07 ` jvdelisle at gcc dot gnu dot org
  2008-11-13 15:56 ` burnus at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-11-13  6:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from jvdelisle at gcc dot gnu dot org  2008-11-13 06:06 -------
A patch has been submitted for review.


-- 


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


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

* [Bug libfortran/37294] Namelist I/O to array character internal units
  2008-08-31  0:21 [Bug libfortran/37294] New: Namelist I/O to array character internal units jvdelisle at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2008-11-13  6:07 ` jvdelisle at gcc dot gnu dot org
@ 2008-11-13 15:56 ` burnus at gcc dot gnu dot org
  2008-11-15 19:28 ` jvdelisle at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2008-11-13 15:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from burnus at gcc dot gnu dot org  2008-11-13 15:55 -------
Patch was: http://gcc.gnu.org/ml/fortran/2008-11/msg00080.html

I'm not completely satisfied with the patch it will break code such as:
  character(50) :: line(2)
  namelist /stuff/ n, m
  n = 123
  m = 456
  write(line,nml=stuff)
which worked before. The true solution would be to do the same as NAG f95 does
(cf. comment 2), but the challenge is to do is such that there is no
performance penalty for code which fits into one line / for scalars.


-- 


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


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

* [Bug libfortran/37294] Namelist I/O to array character internal units
  2008-08-31  0:21 [Bug libfortran/37294] New: Namelist I/O to array character internal units jvdelisle at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2008-11-13 15:56 ` burnus at gcc dot gnu dot org
@ 2008-11-15 19:28 ` jvdelisle at gcc dot gnu dot org
  2008-11-15 19:35 ` jvdelisle at gcc dot gnu dot org
  2008-11-15 19:41 ` jvdelisle at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-11-15 19:28 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from jvdelisle at gcc dot gnu dot org  2008-11-15 19:27 -------
Subject: Bug 37294

Author: jvdelisle
Date: Sat Nov 15 19:25:35 2008
New Revision: 141892

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141892
Log:
2008-11-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libfortran/37294
        * io/write.c (namelist_write_newline): Use array loop specification to
        advance to next internal array unit record. (namelist_write): Adjust to
        accomodate the internal array unit behavior.

Modified:
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/io/write.c


-- 


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


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

* [Bug libfortran/37294] Namelist I/O to array character internal units
  2008-08-31  0:21 [Bug libfortran/37294] New: Namelist I/O to array character internal units jvdelisle at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2008-11-15 19:28 ` jvdelisle at gcc dot gnu dot org
@ 2008-11-15 19:35 ` jvdelisle at gcc dot gnu dot org
  2008-11-15 19:41 ` jvdelisle at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-11-15 19:35 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jvdelisle at gcc dot gnu dot org  2008-11-15 19:34 -------
Subject: Bug 37294

Author: jvdelisle
Date: Sat Nov 15 19:33:07 2008
New Revision: 141893

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141893
Log:
2008-11-15  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

        PR libfortran/37294
        * gfortran.dg/namelist_57.f90: New test.
        * gfortran.dg/namelist_print_1.f: Adjust test conditions.

Added:
    trunk/gcc/testsuite/gfortran.dg/namelist_57.f90
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gfortran.dg/namelist_print_1.f


-- 


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


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

* [Bug libfortran/37294] Namelist I/O to array character internal units
  2008-08-31  0:21 [Bug libfortran/37294] New: Namelist I/O to array character internal units jvdelisle at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2008-11-15 19:35 ` jvdelisle at gcc dot gnu dot org
@ 2008-11-15 19:41 ` jvdelisle at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jvdelisle at gcc dot gnu dot org @ 2008-11-15 19:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from jvdelisle at gcc dot gnu dot org  2008-11-15 19:39 -------
Fixed on trunk. I will open a new PR for enhancement of this to better utilize
the internal unit array by doing fewer "newlines" for namelists.


-- 

jvdelisle at gcc dot gnu dot org changed:

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


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


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

end of thread, other threads:[~2008-11-15 19:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-31  0:21 [Bug libfortran/37294] New: Namelist I/O to array character internal units jvdelisle at gcc dot gnu dot org
2008-08-31  0:25 ` [Bug libfortran/37294] " jvdelisle at gcc dot gnu dot org
2008-08-31  9:13 ` burnus at gcc dot gnu dot org
2008-11-13  6:07 ` jvdelisle at gcc dot gnu dot org
2008-11-13 15:56 ` burnus at gcc dot gnu dot org
2008-11-15 19:28 ` jvdelisle at gcc dot gnu dot org
2008-11-15 19:35 ` jvdelisle at gcc dot gnu dot org
2008-11-15 19:41 ` jvdelisle 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).