re PR fortran/31201 (Too large unit number generates wrong code)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 6 May 2007 22:37:27 +0000 (22:37 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Sun, 6 May 2007 22:37:27 +0000 (22:37 +0000)
2007-05-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR fortran/31201
* gfortran.dg/large_unit_1.f90: New.
* gfortran.dg/large_unit_2.f90: New.
* gfortran.dg/iostat_4.f90: New
* gfortran.dg/bounds_check_fail_1.f90: Updated.

From-SVN: r124481

gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/bounds_check_fail_1.f90
gcc/testsuite/gfortran.dg/iostat_4.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/large_unit_1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/large_unit_2.f90 [new file with mode: 0644]

index 2b74f7cc8f842c561f3df00917b37ed5ae419cf7..36cec0d7f3256567362ef6f014f80290aeb3020d 100644 (file)
@@ -1,3 +1,11 @@
+2007-05-06  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/31201
+       * gfortran.dg/large_unit_1.f90: New.
+       * gfortran.dg/large_unit_2.f90: New.
+       * gfortran.dg/iostat_4.f90: New
+       * gfortran.dg/bounds_check_fail_1.f90: Updated.
+
 2007-05-06  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/31540
index 938d19a6409532b2d9eb110c345310935354e533..8617456f1e0355ea7b6e0476e654ec79885b18e2 100644 (file)
@@ -4,4 +4,4 @@
   integer x(1)
   x(2) = x(1) ! { dg-warning "out of bounds" }
   end
-! { dg-output "out of bounds for array 'x', upper bound of dimension 1 exceeded.*at line 5" }
+! { dg-output "out of bounds for array 'x', upper bound of dimension 1 exceeded." }
diff --git a/gcc/testsuite/gfortran.dg/iostat_4.f90 b/gcc/testsuite/gfortran.dg/iostat_4.f90
new file mode 100644 (file)
index 0000000..34c25f9
--- /dev/null
@@ -0,0 +1,9 @@
+! { dg-do run }
+! PR31201 Too large unit number generates wrong code
+! This tests initialization of the IOSTAT variable
+  integer :: i
+  character(len=50) :: str
+  write (2_8*int(huge(0_4),kind=8)+9_8, iostat=i, iomsg=str) 555
+  if (i.ne.5005) call abort
+  if (str.ne."Unit number in I/O statement too large") call abort
+  end 
\ No newline at end of file
diff --git a/gcc/testsuite/gfortran.dg/large_unit_1.f90 b/gcc/testsuite/gfortran.dg/large_unit_1.f90
new file mode 100644 (file)
index 0000000..60e2d1f
--- /dev/null
@@ -0,0 +1,17 @@
+! { dg-do run }
+! { dg-shouldfail "Unit number in I/O statement too large" }
+! PR31201  Unit number in I/O statement too large
+! Test case from PR
+      integer(kind=8)  :: k= 2_8**36 + 10
+      integer(kind=4)  :: j= 10
+      logical  ex,op
+      INQUIRE(unit=k, exist=ex,opened=op)
+      print *, ex, op
+      IF (ex) THEN
+         OPEN(unit=k)
+         INQUIRE(unit=j, opened=op)
+         IF (op) CALL ABORT()
+      ENDIF
+      print *, k
+      close(k)
+      end
diff --git a/gcc/testsuite/gfortran.dg/large_unit_2.f90 b/gcc/testsuite/gfortran.dg/large_unit_2.f90
new file mode 100644 (file)
index 0000000..5f3554c
--- /dev/null
@@ -0,0 +1,13 @@
+! { dg-do run }
+! PR31201 Too large unit number generates wrong code 
+! Test case by Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
+      integer :: i
+      logical :: l
+      character(len=60) :: s
+      open(2_8*huge(0)+20_8,file="foo",iostat=i)
+      if (i == 0) call abort
+      open(2_8*huge(0)+20_8,file="foo",err=99)
+      call abort
+ 99   inquire(unit=18,opened=l)
+      if (l) call abort
+      end