re PR fortran/66461 (ICE on missing end program in fixed source)
authorJerry DeLisle <jvdelisle@gcc.gnu.org>
Tue, 24 May 2016 04:15:39 +0000 (04:15 +0000)
committerJerry DeLisle <jvdelisle@gcc.gnu.org>
Tue, 24 May 2016 04:15:39 +0000 (04:15 +0000)
2016-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

PR fortran/66461
* scanner.c (gfc_next_char_literal): Clear end_flag when adjusting
current locus back to old_locus.

* gfortran.dg/unexpected_eof.f: New test

From-SVN: r236627

gcc/fortran/ChangeLog
gcc/fortran/scanner.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/unexpected_eof.f [new file with mode: 0644]

index d32c7d5100a9fb54173a14ce28170e4d30b8b168..8db70173d2758e78f885f34ca4edfcee43f5afdd 100644 (file)
@@ -1,3 +1,9 @@
+2016-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/66461
+       * scanner.c (gfc_next_char_literal): Clear end_flag when adjusting
+       current locus back to old_locus.
+
 2016-05-20  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/71204
index f4dedd69757a0da13af67ac81934a1cbd7721d69..6a7a5b68bb3e0c944785107ee254a78a19a589e3 100644 (file)
@@ -1556,6 +1556,7 @@ restart:
 not_continuation:
   c = '\n';
   gfc_current_locus = old_loc;
+  end_flag = 0;
 
 done:
   if (c == '\n')
index ed80db55d443c811dce7600ef7f749cc2aeab7b9..49789988c96d189bfa0fe7784e74df1cf62b6a1c 100644 (file)
@@ -1,3 +1,8 @@
+2016-05-23  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
+
+       PR fortran/66461
+       * gfortran.dg/unexpected_eof.f: New test
+
 2016-05-23  Michael Meissner  <meissner@linux.vnet.ibm.com>
            Kelvin Nilsen  <kelvin@gcc.gnu.org>
 
diff --git a/gcc/testsuite/gfortran.dg/unexpected_eof.f b/gcc/testsuite/gfortran.dg/unexpected_eof.f
new file mode 100644 (file)
index 0000000..d3cdb99
--- /dev/null
@@ -0,0 +1,8 @@
+! { dg-do compile }
+! PR66461  ICE on missing end program in fixed source
+      program p
+         integer x(2)
+         x = -1
+         if ( x(1) < 0 .or.
+     &        x(2) < 0 ) print *, x
+! { dg-error "Unexpected end of file" "" { target *-*-* } 0 }