From e3228a50387ff82d51f2edc37bc12e91fa21a25f Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Fri, 30 Sep 2016 23:19:58 +0000 Subject: [PATCH] re PR fortran/66643 (Missing compilation error for formatted data transfer without format) 2016-09-30 Jerry DeLisle PR fortran/66643 * io.c (match_dt_unit): Peek check for missing format. * gfortran.fortran-torture/compile/arrayio.f90: Update test. * gfortran.fortran-torture/compile/write.f90: Update test. From-SVN: r240686 --- gcc/fortran/ChangeLog | 5 +++++ gcc/fortran/io.c | 6 ++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gfortran.fortran-torture/compile/arrayio.f90 | 2 +- gcc/testsuite/gfortran.fortran-torture/compile/write.f90 | 4 ++-- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 19349a1a82b..e3097249af4 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2016-09-30 Jerry DeLisle + + PR fortran/66643 + * io.c (match_dt_unit): Peek check for missing format. + 2016-09-30 Fritz Reese PR fortran/77764 diff --git a/gcc/fortran/io.c b/gcc/fortran/io.c index 48c15ef55f9..7c48c491eeb 100644 --- a/gcc/fortran/io.c +++ b/gcc/fortran/io.c @@ -2688,6 +2688,7 @@ static match match_dt_unit (io_kind k, gfc_dt *dt) { gfc_expr *e; + char c; if (gfc_match_char ('*') == MATCH_YES) { @@ -2695,6 +2696,11 @@ match_dt_unit (io_kind k, gfc_dt *dt) goto conflict; dt->io_unit = default_unit (k); + + c = gfc_peek_ascii_char (); + if (c == ')') + gfc_error_now ("Missing format with default unit at %C"); + return MATCH_YES; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 93f72c32974..01a18526be3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-09-30 Jerry DeLisle + + PR fortran/66643 + * gfortran.fortran-torture/compile/arrayio.f90: Update test. + * gfortran.fortran-torture/compile/write.f90: Update test. + 2016-09-30 Matthew Wawhab * gcc.target/arm/fp16-aapcs-3.c: Replace arm_fp16_ok with diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/arrayio.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/arrayio.f90 index 1eec0bb59ce..8c333d437d2 100644 --- a/gcc/testsuite/gfortran.fortran-torture/compile/arrayio.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/compile/arrayio.f90 @@ -8,5 +8,5 @@ program arrayio a(:, j) = (/ (i + (j - 1) * 5, i=1,5) /) end do - write (*) a + write (*,*) a end program diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/write.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/write.f90 index 50b83cc6a12..82ca8be4bdd 100644 --- a/gcc/testsuite/gfortran.fortran-torture/compile/write.f90 +++ b/gcc/testsuite/gfortran.fortran-torture/compile/write.f90 @@ -1,5 +1,5 @@ ! Program to test simple IO program testwrite - write (*) 1 - write (*) "Hello World" + write (*,*) 1 + write (*,*) "Hello World" end program -- 2.30.2