In brief: A namelist read of a structure component that is a vector when that structure has another component that is a structure results in a runtime error. Test file: program test implicit none type tao_title_struct character(2) justify end type type tao_plot_page_struct real shape_height_max type (tao_title_struct) title ! Comment this line out and the bug goes away. real size(2) end type type (tao_plot_page_struct) plot_page namelist / params / plot_page open (1, file = 'test.in') read (1, nml = params) close (1) end program The file test.in is: ¶ms plot_page%size = 1, 2 / Compiling and running gives: [atf2code@lnx209 test]$ gfortran -v -save-temps test.f90 Driving: gfortran -v -save-temps test.f90 -lgfortranbegin -lgfortran -lm -shared-libgcc Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc-4.4.1/configure --prefix=/home/atf2code/atf2/usr_local --with-gmp=/home/atf2code/atf2/usr_local --with-mpfr=/home/atf2code/atf2/usr_local Thread model: posix gcc version 4.4.1 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic' /a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../libexec/gcc/i686-pc-linux-gnu/4.4.1/f951 test.f90 -quiet -dumpbase test.f90 -mtune=generic -auxbase test -version -fintrinsic-modules-path /a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/finclude -o test.s GNU Fortran (GCC) version 4.4.1 (i686-pc-linux-gnu) compiled by GNU C version 4.4.1, GMP version 4.3.1, MPFR version 2.4.1. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic' as -V -Qy -o test.o test.s GNU assembler version 2.15.92.0.2 (i386-redhat-linux) using BFD version 2.15.92.0.2 20040927 COMPILER_PATH=/a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../libexec/gcc/i686-pc-linux-gnu/4.4.1/:/a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../libexec/gcc/ LIBRARY_PATH=/a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/:/a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../lib/gcc/:/a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-save-temps' '-shared-libgcc' '-mtune=generic' /a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../libexec/gcc/i686-pc-linux-gnu/4.4.1/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/crtbegin.o -L/a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1 -L/a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../lib/gcc -L/a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/../../.. test.o -lgfortranbegin -lgfortran -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /a/lnx113/nfs/acc/temp/atf2/usr_local/bin/../lib/gcc/i686-pc-linux-gnu/4.4.1/crtend.o /usr/lib/crtn.o [atf2code@lnx209 test]$ ./a.out At line 20 of file test.f90 (unit = 1, file = 'test.in') Fortran runtime error: Cannot match namelist object name 1 Note: If the "title" component of tao_plot_page_struct is commented out or moved below the "size" component then the program runs without fail.
Created attachment 18250 [details] test.s file generated by the compile
Confirmed. Fails with gfortran 4.1 to 4.5 and is thus no regression, but it works with ifort, g95, openf95, and NAG f95.
I will get started on this.
As a work-around, re-arranging the derived type like this: type tao_plot_page_struct real size(2) real shape_height_max type (tao_title_struct) title end type May help, until I get this sorted out.
Created attachment 18265 [details] A simple patch to resolve the problem This patch solves the original test case. It does require modification of test suite cases namelist_40.f90 and namelist_47.f90. With the patch, those two test cases have a slightly modified error output. Additional testing is always appreciated. I will prepare a submittal for approval tomorrow.
Patch submitted for approval: http://gcc.gnu.org/ml/fortran/2009-08/msg00001.html
Subject: Bug 40853 Author: jvdelisle Date: Sun Aug 2 18:31:07 2009 New Revision: 150356 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150356 Log: 2009-08-02 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/40853 * io/list_read.c (nml_get_obj_data): Do not set nl pointer to first_nl if nl->next is NULL. Modified: trunk/libgfortran/ChangeLog trunk/libgfortran/io/list_read.c
Subject: Bug 40853 Author: jvdelisle Date: Sun Aug 2 18:47:46 2009 New Revision: 150357 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150357 Log: 2009-08-02 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/40853 * gfortran.dg/namelist_40.f90: Update error output. * gfortran.dg/namelist_47.f90: Update error output. * gfortran.dg/namelist_58.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/namelist_58.f90 Modified: trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/namelist_40.f90 trunk/gcc/testsuite/gfortran.dg/namelist_47.f90
Subject: Bug 40853 Author: jvdelisle Date: Wed Aug 5 03:15:18 2009 New Revision: 150476 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150476 Log: 2009-08-04 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/40853 * io/list_read.c (nml_get_obj_data): Do not set nl pointer to first_nl if nl->next is NULL. Modified: branches/gcc-4_4-branch/libgfortran/ChangeLog branches/gcc-4_4-branch/libgfortran/io/list_read.c
Subject: Bug 40853 Author: jvdelisle Date: Wed Aug 5 03:17:52 2009 New Revision: 150477 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=150477 Log: 2009-08-04 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR libfortran/40853 * gfortran.dg/namelist_40.f90: Update error output. * gfortran.dg/namelist_47.f90: Update error output. * gfortran.dg/namelist_58.f90: New test. Added: branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/namelist_58.f90 Modified: branches/gcc-4_4-branch/gcc/testsuite/ChangeLog branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/namelist_40.f90 branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/namelist_47.f90
Fixed on 4.4 and 4.5, closing