]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libfortran/34427 (Revision 130708 breaks namelist input)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Mon, 17 Dec 2007 00:51:25 +0000 (00:51 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Mon, 17 Dec 2007 00:51:25 +0000 (00:51 +0000)
2007-12-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR fortran/34427
* gfortran.dg/namelist_42.f90: Update.
* gfortran.dg/namelist_43.f90: New.

From-SVN: r131004

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/namelist_42.f90
gcc/testsuite/gfortran.dg/namelist_43.f90 [new file with mode: 0644]

index 0c14c4eb4d00cfafd5d6a9101f77228d9a50829b..282551969b8aba50ccf427866cb694c6ddf23d63 100644 (file)
@@ -1,3 +1,9 @@
+2007-12-16  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/34427
+       * gfortran.dg/namelist_42.f90: Update.
+       * gfortran.dg/namelist_43.f90: New.
+       
 2007-12-16  Tobias Burnus  <burnus@net-b.de>
 
        PR fortran/34495
index b0095fe0e6a048a45150ca02a9ca3a1e47541f0a..e2efb6f74672e4b2d3937e5f5ee9abcc00c28d26 100644 (file)
   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 (file)
index 0000000..467b11d
--- /dev/null
@@ -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