re PR fortran/52564 (Accepts invalid: Missing I/O list after comma)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Thu, 31 Jan 2019 03:37:16 +0000 (03:37 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Thu, 31 Jan 2019 03:37:16 +0000 (03:37 +0000)
2019-01-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR fortran/52564
* io.c (match_io): Add check for comma after '*' without subsequent
IO list.

* gfortran.dg/print_2.f90: New test.

From-SVN: r268412

gcc/fortran/ChangeLog
gcc/fortran/io.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/print_2.f90 [new file with mode: 0644]

index ac9169a76e60c3dd5ca1636f871b822bb389c1be..c78e32af1731cdf2d5933e1b5aa2827a1174f518 100644 (file)
@@ -1,3 +1,9 @@
+2019-01-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/52564
+       * io.c (match_io): Add check for comma after '*' without subsequent
+       IO list.
+
 2019-01-30  Dominique d'Humieres  <dominiq@gcc.gnu.org>
 
        PR fortran/52884
index fce9228c3026bc136a72600e2a9934a6f74afbde..95b3013220350513d0727435d169b2f17bf256fc 100644 (file)
@@ -4172,6 +4172,23 @@ match_io (io_kind k)
              else
                gfc_current_locus = where;
            }
+
+         if (gfc_match_char ('*') == MATCH_YES
+             && gfc_match_char(',') == MATCH_YES)
+           {
+             locus where2 = gfc_current_locus;
+             if (gfc_match_eos () == MATCH_YES)
+               {
+                 gfc_current_locus = where2;
+                 gfc_error ("Comma after * at %C not allowed without I/O list");
+                 m = MATCH_ERROR;
+                 goto cleanup;
+               }
+             else
+               gfc_current_locus = where;
+           }
+         else
+           gfc_current_locus = where;
        }
 
       if (gfc_current_form == FORM_FREE)
index d14df186b0d38f97a53b3d03c26e6e9076b3a1fe..917c13e57a2081195cb16633b04b13f25c409aff 100644 (file)
@@ -1,3 +1,8 @@
+2019-01-30  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/52564
+       * gfortran.dg/print_2.f90: New test.
+
 2019-01-30  Vladimir Makarov  <vmakarov@redhat.com>
 
        PR rtl-optimization/87246
diff --git a/gcc/testsuite/gfortran.dg/print_2.f90 b/gcc/testsuite/gfortran.dg/print_2.f90
new file mode 100644 (file)
index 0000000..4befedf
--- /dev/null
@@ -0,0 +1,7 @@
+! { dg-do compile }
+! PR52564 Accepts invalid: Missing I/O list after comma 
+program printbug
+  print *, 'hello world'
+! the following line should not compile:
+  print *,  ! { dg-error "not allowed" }
+end program