OSDN Git Service

2006-10-17 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / namelist_21.f90
1 !{ dg-do run }
2 ! Tests filling arrays from a namelist read when object list is not complete.
3 ! Developed from a test case provided by Christoph Jacob.
4 ! Contributed by Jerry DeLisle  <jvdelisle@gcc.gnu.org>.
5 program pr24794
6
7    implicit none
8    integer, parameter :: maxop=15, iunit=7
9    character*8 namea(maxop), nameb(maxop)
10    integer i, ier
11
12    namelist/ccsopr/ namea,nameb
13    namea=""
14    nameb=""
15    open (12, status="scratch", delim="apostrophe")
16    write (12, '(a)') "&ccsopr"
17    write (12, '(a)') "    namea='spi01h','spi02o','spi03h','spi04o','spi05h',"
18    write (12, '(a)') "          'spi07o','spi08h','spi09h',"
19    write (12, '(a)') "    nameb='spi01h','spi03h','spi05h','spi06h','spi08h',"
20    write (12, '(a)') "&end"
21
22    rewind (12)
23    read (12, nml=ccsopr, iostat=ier)
24    if (ier.ne.0) call abort()
25    
26    rewind (12)
27    write(12,nml=ccsopr)
28    
29    rewind (12)
30    read (12, nml=ccsopr, iostat=ier)
31    if (ier.ne.0) call abort()
32    
33    if (namea(2).ne."spi02o  ") call abort()
34    if (namea(9).ne."        ") call abort()
35    if (namea(15).ne."        ") call abort()
36    if (nameb(1).ne."spi01h  ") call abort()
37    if (nameb(6).ne."        ") call abort()
38    if (nameb(15).ne."        ") call abort()
39    
40    close (12)
41 end program pr24794