re PR libfortran/33253 (namelist: reading back a string with apostrophe)

2007-10-03  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR libfortran/33253
	* gfortran.dg/namelist_38.f90: New test.
	* gfortran.dg/namelist_39.f90: New test.

From-SVN: r128975
This commit is contained in:
Jerry DeLisle 2007-10-03 00:39:58 +00:00
parent f5ad31630d
commit 855ea443d8
3 changed files with 67 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2007-10-03 Jerry DeLisle <jvdelisle@gcc.gnu.org>
PR libfortran/33253
* gfortran.dg/namelist_38.f90: New test.
* gfortran.dg/namelist_39.f90: New test.
2007-10-03 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
PR libfortran/33469

View File

@ -0,0 +1,36 @@
! { dg-do run }
! PR33253 namelist: reading back a string, also fixed writing with delimiters.
! Test case modified from that of the PR by
! Jerry DeLisle <jvdelisle@gcc.gnu.org>
program main
implicit none
character(len=3) :: a
namelist /foo/ a
open(10, status="scratch", delim="quote")
a = 'a"a'
write(10,foo)
rewind 10
a = ""
read (10,foo) ! This gave a runtime error before the patch.
if (a.ne.'a"a') call abort
close (10)
open(10, status="scratch", delim="apostrophe")
a = "a'a"
write(10,foo)
rewind 10
a = ""
read (10,foo)
if (a.ne."a'a") call abort
close (10)
open(10, status="scratch", delim="none")
a = "a'a"
write(10,foo)
rewind 10
a = ""
read (10,foo)
if (a.ne."a'a") call abort
close (10)
end program main

View File

@ -0,0 +1,25 @@
! { dg-do run }
! PR33421 and PR33253 Weird quotation of namelist output of character arrays
! Test case from Toon Moene, adapted by Jerry DeLisle <jvdelisle@gcc.gnu.org>
program test
implicit none
character(len=45) :: b(3)
namelist /nam/ b
b = 'x'
open(99, status="scratch")
write(99,'(4(a,/),a)') "&NAM", &
" b(1)=' AAP NOOT MIES WIM ZUS JET',", &
" b(2)='SURF.PRESSURE',", &
" b(3)='APEKOOL',", &
" /"
rewind(99)
read(99,nml=nam)
close(99)
if (b(1).ne." AAP NOOT MIES WIM ZUS JET ") call abort
if (b(2).ne."SURF.PRESSURE ") call abort
if (b(3).ne."APEKOOL ") call abort
end program test