[Bug fortran/65541] New: namelist regression
jwmwalrus at gmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Mar 24 15:58:00 GMT 2015
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)
More information about the Gcc-bugs
mailing list