public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jwmwalrus at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/65541] New: namelist regression
Date: Tue, 24 Mar 2015 15:58:00 -0000	[thread overview]
Message-ID: <bug-65541-4@http.gcc.gnu.org/bugzilla/> (raw)

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)


             reply	other threads:[~2015-03-24 15:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-24 15:58 jwmwalrus at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65541-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).