From ffeb38bce907f5d15bc9bb96b07bfdb5263f6051 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Mon, 17 Dec 2007 00:51:25 +0000 Subject: [PATCH] re PR libfortran/34427 (Revision 130708 breaks namelist input) 2007-12-16 Jerry DeLisle PR fortran/34427 * gfortran.dg/namelist_42.f90: Update. * gfortran.dg/namelist_43.f90: New. From-SVN: r131004 --- gcc/testsuite/ChangeLog | 6 +++ gcc/testsuite/gfortran.dg/namelist_42.f90 | 19 ++++++++-- gcc/testsuite/gfortran.dg/namelist_43.f90 | 46 +++++++++++++++++++++++ 3 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/namelist_43.f90 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c14c4eb4d0..282551969b8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2007-12-16 Jerry DeLisle + + PR fortran/34427 + * gfortran.dg/namelist_42.f90: Update. + * gfortran.dg/namelist_43.f90: New. + 2007-12-16 Tobias Burnus PR fortran/34495 diff --git a/gcc/testsuite/gfortran.dg/namelist_42.f90 b/gcc/testsuite/gfortran.dg/namelist_42.f90 index b0095fe0e6a..e2efb6f7467 100644 --- a/gcc/testsuite/gfortran.dg/namelist_42.f90 +++ b/gcc/testsuite/gfortran.dg/namelist_42.f90 @@ -20,9 +20,22 @@ write (10,*) " &nl foo = 5, 5, 5, nan, infinity, infinity " write (10,*) write (10,*) " = 1, /" -! Does not work - !write (10,*) " &nl foo = 5, 5, 5, nan, infinity, infinity" - !write (10,*) " = 1, /" + rewind (10) + READ (10, NML = nl) + close (10) + + if(infinity /= 1) call abort() + if(any(foo(1:3) /= [5.0, 5.0, 5.0]) .or. .not.isnan(foo(4)) & + .or. foo(5) <= huge(foo) .or. any(foo(6:11) /= -1.0)) & + call abort() +! Works too: + foo = -1.0 + infinity = -1 + + open (10, status="scratch") + rewind (10) + write (10,'(a)') "&nl foo = 5, 5, 5, nan, infinity, infinity" + write (10,'(a)') "=1,/" rewind (10) READ (10, NML = nl) CLOSE (10) diff --git a/gcc/testsuite/gfortran.dg/namelist_43.f90 b/gcc/testsuite/gfortran.dg/namelist_43.f90 new file mode 100644 index 00000000000..467b11de145 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/namelist_43.f90 @@ -0,0 +1,46 @@ +! { dg-do run } +! { dg-options "-mieee" { target sh*-*-* } } +! +! PR fortran/34427 +! +! Check that namelists and the real values Inf, NaN, Infinity +! properly coexist with interceding line ends and spaces. +! +PROGRAM TEST + IMPLICIT NONE + real , DIMENSION(10) ::foo + integer :: infinity + integer :: numb + NAMELIST /nl/ foo + NAMELIST /nl/ infinity + foo = -1.0 + infinity = -1 + + open (10, status="scratch") + + write (10,'(a)') " &nl foo(1:6) = 5, 5, 5, nan, infinity" + write (10,'(a)') + write (10,'(a)') + write (10,'(a)') + write (10,'(a)') + write (10,'(a)') "infinity" + write (10,'(a)') + write (10,'(a)') + write (10,'(a)') " " + write (10,'(a)') + write (10,'(a)') + write (10,'(a)') + write (10,'(a)') + write (10,'(a)') + write (10,'(a)') + write (10,'(a)') + write (10,'(a)') + write (10,'(a)') "=1/" + rewind (10) + READ (10, NML = nl) + CLOSE (10) + if(infinity /= 1) call abort + if(any(foo(1:3) /= [5.0, 5.0, 5.0]) .or. .not.isnan(foo(4)) & + .or. (foo(5) <= huge(foo)) .or. any(foo(6:10) /= -1.0)) & + call abort +END PROGRAM TEST