From: Thomas Koenig Date: Fri, 26 May 2006 19:53:18 +0000 (+0000) Subject: re PR fortran/23151 (print (buf, format), expression should be invalid) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d08533cd442757fc3eb564bcd1d56a6420bbd76;p=gcc.git re PR fortran/23151 (print (buf, format), expression should be invalid) 2006-05-26 Thomas Koenig PR fortran/23151 * io.c (match_io): print (1,*) is an error. 2006-05-26 Thomas Koenig 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 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0117eb66bbf..eed3e0edf29 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2006-05-26 Thomas Koenig + + PR fortran/23151 + * io.c (match_io): print (1,*) is an error. + 2006-05-26 Paul Thomas PR fortran/27709 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 30344d90e74..4a55cbd8d87 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 30b650d6889..bcc0bafeece 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +2006-05-26 Thomas Koenig + + 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 PR target/27758 diff --git a/gcc/testsuite/gfortran.dg/inquire_9.f90 b/gcc/testsuite/gfortran.dg/inquire_9.f90 index f1f8ffd1556..99cd1af19cf 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 00000000000..26041c7f1d6 --- /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 00000000000..699f507dafb --- /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