summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/namelist_char_only.f90
blob: 9993669b38a11a78a6114bade1f3dcdb9814b8ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
! { dg-do run }
! { dg-options "-O0" }
! Test patch for PR24416.f90 - a used to come back from the read with var
! prepended.
!
  IMPLICIT NONE
  CHARACTER(len=10)  :: var = "hello"
  character(len=10)  :: a = ""
  NAMELIST /inx/ var

  OPEN(unit=11, status='scratch')
  write (11, *) "&INX"
  write (11, *) "  var = 'goodbye'"
  write (11, *) "&END"
  rewind (11)

  READ(11,NML=inx)
  CLOSE(11)

  OPEN(unit=11, status='scratch')
  write (11, *) "alls_well"
  rewind (11)

  READ(11,*) a
  CLOSE(11)

  if (a /= "alls_well") call abort ()

END