2011-05-23 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / namelist_23.f90
blob7d69ef62f3ca76ecc08865ba950b27d499bbae81
1 !{ dg-do run { target fd_truncate } }
2 ! PR26136 Filling logical variables from namelist read when object list is not
3 ! complete. Test case derived from PR.
4 ! Contributed by Jerry DeLisle <jvdelisle@gcc.gnu.org>
5 program read_logical
6 implicit none
7 logical, dimension(4) :: truely
8 integer, dimension(4) :: truely_a_very_long_variable_name
9 namelist /mynml/ truely
10 namelist /mynml/ truely_a_very_long_variable_name
12 truely = .false.
13 truely_a_very_long_variable_name = 0
15 open(10, status="scratch")
16 write(10,*) "&mynml"
17 write(10,*) "truely = trouble, traffic .true"
18 write(10,*) "truely_a_very_long_variable_name = 4, 4, 4"
19 write(10,*) "/"
20 rewind(10)
21 read (10, nml=mynml, err = 1000)
22 if (.not.all(truely(1:3))) call abort()
23 if (.not.all(truely_a_very_long_variable_name(1:3).eq.4)) call abort()
25 truely = .false.
26 truely_a_very_long_variable_name = 0
28 rewind(10)
29 write(10,*) "&mynml"
30 write(10,*) "truely = .true., .true.,"
31 write(10,*) "truely_a_very_long_variable_name = 4, 4, 4"
32 write(10,*) "/"
33 rewind(10)
34 read (10, nml=mynml, err = 1000)
35 if (.not.all(truely(1:2))) call abort()
36 if (.not.all(truely_a_very_long_variable_name(1:3).eq.4)) call abort()
38 truely = .true.
39 truely_a_very_long_variable_name = 0
41 rewind(10)
42 write(10,*) "&mynml"
43 write(10,*) "truely = .false., .false.,"
44 write(10,*) "truely_a_very_long_variable_name = 4, 4, 4"
45 write(10,*) "/"
46 rewind(10)
47 read (10, nml=mynml, err = 1000)
48 if (all(truely(1:2))) call abort()
49 if (.not.all(truely_a_very_long_variable_name(1:3).eq.4)) call abort()
50 close(10)
51 stop
52 1000 call abort()
53 end program read_logical