re PR fortran/23151 (print (buf, format), expression should be invalid)
authorThomas Koenig <Thomas.Koenig@online.de>
Fri, 26 May 2006 19:53:18 +0000 (19:53 +0000)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Fri, 26 May 2006 19:53:18 +0000 (19:53 +0000)
2006-05-26  Thomas Koenig  <Thomas.Koenig@online.de>

PR fortran/23151
* io.c (match_io):  print (1,*) is an error.

2006-05-26  Thomas Koenig  <Thomas.Koenig@online.de>

PR fortran/23151
* gfortran.dg/inquire_9.f90:  Fix illegal print syntax.
* gfortran.dg/print_parentheses_1.f:  New test.
* gfortran.dg/print_parentheses_2.f90:  New test.

From-SVN: r114138

gcc/fortran/ChangeLog
gcc/fortran/io.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/inquire_9.f90
gcc/testsuite/gfortran.dg/print_parentheses_1.f [new file with mode: 0644]
gcc/testsuite/gfortran.dg/print_parentheses_2.f90 [new file with mode: 0644]

index 0117eb66bbfe2284034d9865c3d55ad843064bce..eed3e0edf29668f24de9e42a4b1986b6b7257748 100644 (file)
@@ -1,3 +1,8 @@
+2006-05-26  Thomas Koenig  <Thomas.Koenig@online.de>
+
+       PR fortran/23151
+       * io.c (match_io):  print (1,*) is an error.
+
 2006-05-26  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/27709
index 30344d90e741a32669287e39cc45dcf97b491b01..4a55cbd8d87c4e1b7f09d058593455c1b0ad9547 100644 (file)
@@ -2424,6 +2424,12 @@ match_io (io_kind k)
       dt->io_unit = default_unit (k);
       goto get_io_list;
     }
+  else
+    {
+      /* Error for constructs like print (1,*).   */
+      if (k == M_PRINT)
+       goto  syntax;
+    }
 
   /* Match a control list */
   if (match_dt_element (k, dt) == MATCH_YES)
index 30b650d68894ec5e2c68378949cc0cb5299ff4b6..bcc0bafeecee71af37beba3818f1e85083d0e688 100644 (file)
@@ -1,3 +1,10 @@
+2006-05-26  Thomas Koenig  <Thomas.Koenig@online.de>
+
+       PR fortran/23151
+       * gfortran.dg/inquire_9.f90:  Fix illegal print syntax.
+       * gfortran.dg/print_parentheses_1.f:  New test.
+       * gfortran.dg/print_parentheses_2.f90:  New test.
+
 2006-05-26  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/27758
index f1f8ffd1556c0ba40eebce2dafecba6826b094d9..99cd1af19cf93efc81662320e17577afc299cbca 100644 (file)
@@ -8,7 +8,7 @@
   inquire (unit=-16, exist=l)
   if (l) call abort
   open (unit=16, file='inquire_9.tst')
-  print (unit=16, fmt='(a)'), 'Test'
+  write (unit=16, fmt='(a)') 'Test'
   l = .false.
   inquire (unit=16, exist=l)
   if (.not.l) call abort
diff --git a/gcc/testsuite/gfortran.dg/print_parentheses_1.f b/gcc/testsuite/gfortran.dg/print_parentheses_1.f
new file mode 100644 (file)
index 0000000..26041c7
--- /dev/null
@@ -0,0 +1,5 @@
+! { dg-do compile }
+      program main
+      character*80 line
+      print (line,'(A)'), 'hello' ! { dg-error "Syntax error" }
+      end
diff --git a/gcc/testsuite/gfortran.dg/print_parentheses_2.f90 b/gcc/testsuite/gfortran.dg/print_parentheses_2.f90
new file mode 100644 (file)
index 0000000..699f507
--- /dev/null
@@ -0,0 +1,5 @@
+! { dg-do compile }
+program main
+  character*80 line
+  print (line,'(A)'), 'hello' ! { dg-error "Syntax error" }
+end program main