[Bug libfortran/49791] New: [4.6 Regression] Formatted namelist reads of arrays don't work

2011-07-20 Thread quantum.analyst at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49791

   Summary: [4.6 Regression] Formatted namelist reads of arrays
don't work
   Product: gcc
   Version: 4.6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libfortran
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: quantum.anal...@gmail.com


Created attachment 24797
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24797
Code to reproduce problem

I have some old code that performs a namelist read on a file of formatted form.
There's an array in the namelist. With 4.5.1, reading works just fine, and I
get the following output:

 xpos   0.   0.10001   0.20001 
 0.2   0.400020.   
0.0.0. 
  0.  ypos  0.5   0.59998  
0.69996   0.80004   0.90002
   0.0.0.  
 0.0. 


But with 4.6.0, I get the following error:

At line 15 of file gf-namelist.f (unit = 4, file = 'geometry.in')
Fortran runtime error: Cannot match namelist object name 0.60



gfortran -v for working version:
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.5.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,lto --enable-plugin
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) 

gfortran -v for non-working version:
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.6.0/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.6.0 20110530 (Red Hat 4.6.0-9) (GCC)


[Bug libfortran/49791] [4.4/4.5/4.6/4.7 Regression] Formatted namelist reads fails with: Cannot match namelist object

2011-07-20 Thread quantum.analyst at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49791

--- Comment #6 from Elliott Sales de Andrade  
2011-07-20 21:09:20 UTC ---
(In reply to comment #3)
> If the bug reporter can, I think he should convert all the input files to the
> Fortran 90 syntax of namelists. However, one needs to be careful to not
> inadvertently to change the meaning (e.g. remove the wrong "(1)") and it might
> affect many files.
> 

I can change the test suite, but since we also use the Intel and PGI compilers,
I wouldn't be able to guarantee other people won't get confused with this.

(In reply to comment #4)
> 
> It's an undocumented bug^H^H^H extension.
> 
> The undocumented extension cannot be flagged by any combination of
> -Wall, -Wextra, -fcheck=all, -Wsurprising and/or -std=f95,f2003,f2008.

Perhaps I am misreading it, but I thought it was actually documented at
http://gcc.gnu.org/onlinedocs/gfortran/Extensions-to-namelist.html

> Expanded namelist reads are permitted. This causes an error if -std=f95 is
> used. In the following example, the first element of the array will be given
> the value 0.00 and the two succeeding elements will be given the values 1.00
> and 2.00.
>
> &MYNML
>   X(1,1) = 0.00 , 1.00 , 2.00
> /
>