diff options
author | Thomas Koenig <Thomas.Koenig@online.de> | 2006-05-26 19:53:18 +0000 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2006-05-26 19:53:18 +0000 |
commit | 4d08533cd442757fc3eb564bcd1d56a6420bbd76 (patch) | |
tree | cce105d2a8a9efe92aedfc36f6243be9dd45f8f5 | |
parent | dd46a4ded128ec8c0cf02aa20d24ae2783e0c68e (diff) | |
download | gcc-4d08533cd442757fc3eb564bcd1d56a6420bbd76.zip gcc-4d08533cd442757fc3eb564bcd1d56a6420bbd76.tar.gz gcc-4d08533cd442757fc3eb564bcd1d56a6420bbd76.tar.bz2 |
re PR fortran/23151 (print (buf, format), expression should be invalid)
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
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/io.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/inquire_9.f90 | 2 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/print_parentheses_1.f | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/print_parentheses_2.f90 | 5 |
6 files changed, 29 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0117eb6..eed3e0e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -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 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 30344d9..4a55cbd 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -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) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 30b650d..bcc0baf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/gfortran.dg/inquire_9.f90 b/gcc/testsuite/gfortran.dg/inquire_9.f90 index f1f8ffd..99cd1af 100644 --- a/gcc/testsuite/gfortran.dg/inquire_9.f90 +++ b/gcc/testsuite/gfortran.dg/inquire_9.f90 @@ -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 index 0000000..26041c7 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/print_parentheses_1.f @@ -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 index 0000000..699f507 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/print_parentheses_2.f90 @@ -0,0 +1,5 @@ +! { dg-do compile } +program main + character*80 line + print (line,'(A)'), 'hello' ! { dg-error "Syntax error" } +end program main |