public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/65541] New: namelist regression
@ 2015-03-24 15:58 jwmwalrus at gmail dot com
  2015-03-24 17:47 ` [Bug fortran/65541] " jvdelisle at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jwmwalrus at gmail dot com @ 2015-03-24 15:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65541

            Bug ID: 65541
           Summary: namelist regression
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jwmwalrus at gmail dot com

Version 5.0 of the gfortran runtime cannot read the namelist in the file that
was generated by the code below, using gfortran 4.9. The opposite also holds
(i.e., the runtime of version 4.9 cannot read a namelist generated by version
5.0).


use ISO_FORTRAN_ENV

implicit none

type :: t1
    integer :: i = 0
end type

type, extends(t1) :: t2
    integer :: j = 0
end type

type, extends(t2) :: t3
    integer :: k = 0
end type

integer :: lu, ios
character(255) :: msg

type(t3) :: a

namelist/some/a

!open (newunit = lu, file = 'some.dat', status = 'OLD', access = 'SEQUENTIAL',
action = 'READ', &
open (newunit = lu, file = 'some.dat', status = 'REPLACE', access =
'SEQUENTIAL', action = 'WRITE', &
    position = 'REWIND', iostat = ios, iomsg = msg)
    if (ios /= 0) goto 100

!    read (lu, some, IOSTAT = ios, IOMSG = msg)
    write (lu, some, IOSTAT = ios, IOMSG = msg)
    if (ios /= 0) goto 100
close (lu)

stop

100 continue
write (ERROR_UNIT, '(A)') TRIM(msg)
stop 1

end



The output generated by gfortran 4.9 is:

$ ll `which gfortran`
lrwxrwxrwx 1 root root 12 Feb 25 07:13 /usr/bin/gfortran -> gfortran-4.9*
$ gfortran test_namelist.f90 
$ ./a.out 
$ cat some.dat 
&SOME
 A%T2%T1%I=          0,
 A%T2%J=          0,
 A%K=          0,
 /


The output generated by gfortran 5.0 is:

$ ll `which gfortran-5.0`
lrwxrwxrwx 1 root staff 35 Feb 26 11:01 /usr/local/bin/gfortran-5.0 ->
../../lib/gcc-snapshot/bin/gfortran*
$ gfortran-5.0 test_namelist.f90 
$ ./a.out 
$ cat some.dat 
&SOME
 A+T2+T1%I=          0,
 A+T2+J=          0,
 A+K=          0,
 /

I hope that's not the intended behavior, since it makes namelists generated by
gfortran incompatible with those generated by every other Fortran compiler.



System and compiler information follows:

$ lsb_release -rd && apt-cache policy gfortran && gfortran -v && gfortran-5.0
-v
Description:    Debian GNU/Linux 8.0 (jessie)
Release:    8.0
gfortran:
  Installed: 4:4.9.2-2
  Candidate: 4:4.9.2-2
  Version table:
     4:5-3 0
        101 http://ftp.us.debian.org/debian/ experimental/main amd64 Packages
 *** 4:4.9.2-2 0
        500 http://ftp.us.debian.org/debian/ testing/main amd64 Packages
        200 http://ftp.us.debian.org/debian/ unstable/main amd64 Packages
        100 /var/lib/dpkg/status
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.9.2-10'
--with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.2 (Debian 4.9.2-10) 
Using built-in specs.
COLLECT_GCC=gfortran-5.0
COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 20150319-1'
--with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs
--enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++
--prefix=/usr/lib/gcc-snapshot --enable-shared --enable-linker-build-id
--disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=c++98
--enable-gnu-unique-object --disable-vtable-verify --enable-libmpx
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-snap-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-snap-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-snap-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--disable-werror --enable-checking=yes --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.0.0 20150319 (experimental) [trunk revision 221517] (Debian
20150319-1)


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

* [Bug fortran/65541] namelist regression
  2015-03-24 15:58 [Bug fortran/65541] New: namelist regression jwmwalrus at gmail dot com
@ 2015-03-24 17:47 ` jvdelisle at gcc dot gnu.org
  2015-03-24 19:49 ` [Bug fortran/65541] [5 Regression] " dominiq at lps dot ens.fr
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-03-24 17:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65541

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jvdelisle at gcc dot gnu.org

--- Comment #1 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
I will investigate this later tonight if I can.


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

* [Bug fortran/65541] [5 Regression] namelist regression
  2015-03-24 15:58 [Bug fortran/65541] New: namelist regression jwmwalrus at gmail dot com
  2015-03-24 17:47 ` [Bug fortran/65541] " jvdelisle at gcc dot gnu.org
@ 2015-03-24 19:49 ` dominiq at lps dot ens.fr
  2015-03-25 14:26 ` dominiq at lps dot ens.fr
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-03-24 19:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65541

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-03-24
            Summary|namelist regression         |[5 Regression] namelist
                   |                            |regression
     Ever confirmed|0                           |1

--- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
This is due to revision r210934 (pr55117) from:

    * trans-io.c (nml_full_name, transfer_namelist_element): Insert
    a '+' rather then '%' to differentiate namelist variable names
    that are based on extended derived types.

this seems to have been done on purpose (I did not follow the discussion in the
PR).


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

* [Bug fortran/65541] [5 Regression] namelist regression
  2015-03-24 15:58 [Bug fortran/65541] New: namelist regression jwmwalrus at gmail dot com
  2015-03-24 17:47 ` [Bug fortran/65541] " jvdelisle at gcc dot gnu.org
  2015-03-24 19:49 ` [Bug fortran/65541] [5 Regression] " dominiq at lps dot ens.fr
@ 2015-03-25 14:26 ` dominiq at lps dot ens.fr
  2015-03-26  4:15 ` jvdelisle at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-03-25 14:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65541

--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> This fixes it: ...

Confimed (the patch in comment 4 does not apply cleanly and needs some minor
surgery) and it regtest without regression.

Thanks for quick fix.


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

* [Bug fortran/65541] [5 Regression] namelist regression
  2015-03-24 15:58 [Bug fortran/65541] New: namelist regression jwmwalrus at gmail dot com
                   ` (2 preceding siblings ...)
  2015-03-25 14:26 ` dominiq at lps dot ens.fr
@ 2015-03-26  4:15 ` jvdelisle at gcc dot gnu.org
  2015-04-01 14:25 ` jwmwalrus at gmail dot com
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-03-26  4:15 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65541

Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed:

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

--- Comment #7 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Fixed. No test case needed.


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

* [Bug fortran/65541] [5 Regression] namelist regression
  2015-03-24 15:58 [Bug fortran/65541] New: namelist regression jwmwalrus at gmail dot com
                   ` (3 preceding siblings ...)
  2015-03-26  4:15 ` jvdelisle at gcc dot gnu.org
@ 2015-04-01 14:25 ` jwmwalrus at gmail dot com
  2015-04-01 16:16 ` jvdelisle at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jwmwalrus at gmail dot com @ 2015-04-01 14:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65541

--- Comment #8 from John <jwmwalrus at gmail dot com> ---
Hi,

It seems that some testing was required after all.  With the latest gcc
snapshot from Debian (20150329-1) I still get the same output from the test
code:

$ ll `which gfortran-5.0 `
lrwxrwxrwx 1 root staff 35 Feb 26 11:01 /usr/local/bin/gfortran-5.0 ->
../../lib/gcc-snapshot/bin/gfortran*
$ gfortran-5.0 test_namelist.f90 
$ ./a.out 
$ cat some.dat 
&SOME
 A+T2+T1%I=          0,
 A+T2+J=          0,
 A+K=          0,
 /


In my actual code, what fails is READING a namelist generated by a previous
version of gfortran, so maybe that needs some checking as well?


System and compiler information follows:

$ lsb_release -rd && gfortran-5.0 -v
Description:    Debian GNU/Linux 8.0 (jessie)
Release:    8.0
Using built-in specs.
COLLECT_GCC=gfortran-5.0
COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/5.0.0/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 20150329-1'
--with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs
--enable-languages=c,ada,c++,java,go,fortran,objc,obj-c++
--prefix=/usr/lib/gcc-snapshot --enable-shared --enable-linker-build-id
--disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=c++98
--enable-gnu-unique-object --disable-vtable-verify --enable-libmpx
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-snap-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-snap-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-snap-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --with-arch-32=i586 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic
--disable-werror --enable-checking=yes --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.0.0 20150329 (experimental) [trunk revision 221764] (Debian
20150329-1)


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

* [Bug fortran/65541] [5 Regression] namelist regression
  2015-03-24 15:58 [Bug fortran/65541] New: namelist regression jwmwalrus at gmail dot com
                   ` (4 preceding siblings ...)
  2015-04-01 14:25 ` jwmwalrus at gmail dot com
@ 2015-04-01 16:16 ` jvdelisle at gcc dot gnu.org
  2015-04-01 16:19 ` jvdelisle at gcc dot gnu.org
  2015-04-06 14:40 ` jwmwalrus at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-04-01 16:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65541

--- Comment #9 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
(In reply to John from comment #8)
> Hi,
> 
> It seems that some testing was required after all.  With the latest gcc
> snapshot from Debian (20150329-1) I still get the same output from the test
> code:
> 
Full testing was done. For me here, if you do not explicitly set the
LD_LIBRARY_PATH its possible to compile with one version of gfortran and
execute with another library.  So, try it with -static to make sure that is not
the issue.

Also I did confirm with your example in your original post here that output
from 5. is compatible with 4.9 and the 4.9 compiled with -static could actually
read correctly output generated by 5.0. My comment about testing relates to not
being able to run 4.9 and 5.0 automatically in our test suite.

If you still see a problem, let me know, maybe there is something else going
on.


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

* [Bug fortran/65541] [5 Regression] namelist regression
  2015-03-24 15:58 [Bug fortran/65541] New: namelist regression jwmwalrus at gmail dot com
                   ` (5 preceding siblings ...)
  2015-04-01 16:16 ` jvdelisle at gcc dot gnu.org
@ 2015-04-01 16:19 ` jvdelisle at gcc dot gnu.org
  2015-04-06 14:40 ` jwmwalrus at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jvdelisle at gcc dot gnu.org @ 2015-04-01 16:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65541

--- Comment #10 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
For the record, my results with trunk:

$ gfc pr65541.f90
$ ./a.out 
$ cat some.dat 
&SOME
 A%T2%T1%I=          0,
 A%T2%J=          0,
 A%K=          0,
 /


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

* [Bug fortran/65541] [5 Regression] namelist regression
  2015-03-24 15:58 [Bug fortran/65541] New: namelist regression jwmwalrus at gmail dot com
                   ` (6 preceding siblings ...)
  2015-04-01 16:19 ` jvdelisle at gcc dot gnu.org
@ 2015-04-06 14:40 ` jwmwalrus at gmail dot com
  7 siblings, 0 replies; 9+ messages in thread
From: jwmwalrus at gmail dot com @ 2015-04-06 14:40 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65541

--- Comment #11 from John <jwmwalrus at gmail dot com> ---
Yes, -static does the trick when it comes to the namelist ---although, in the
actual program, I get an obscure error when I try to invoke C's execv/waitpid.

Thanks a lot for the help provided, and sorry for the inconvenience.


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

end of thread, other threads:[~2015-04-06 14:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-24 15:58 [Bug fortran/65541] New: namelist regression jwmwalrus at gmail dot com
2015-03-24 17:47 ` [Bug fortran/65541] " jvdelisle at gcc dot gnu.org
2015-03-24 19:49 ` [Bug fortran/65541] [5 Regression] " dominiq at lps dot ens.fr
2015-03-25 14:26 ` dominiq at lps dot ens.fr
2015-03-26  4:15 ` jvdelisle at gcc dot gnu.org
2015-04-01 14:25 ` jwmwalrus at gmail dot com
2015-04-01 16:16 ` jvdelisle at gcc dot gnu.org
2015-04-01 16:19 ` jvdelisle at gcc dot gnu.org
2015-04-06 14:40 ` jwmwalrus at gmail 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).