From 85d5c27d78e0698914c3442acf7273c4ea4b1863 Mon Sep 17 00:00:00 2001 From: Jerry DeLisle Date: Tue, 24 May 2016 04:15:39 +0000 Subject: [PATCH] re PR fortran/66461 (ICE on missing end program in fixed source) 2016-05-23 Jerry DeLisle 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 | 6 ++++++ gcc/fortran/scanner.c | 1 + gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/unexpected_eof.f | 8 ++++++++ 4 files changed, 20 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/unexpected_eof.f diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d32c7d5100a..8db70173d27 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-05-23 Jerry DeLisle + + 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 PR fortran/71204 diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c index f4dedd69757..6a7a5b68bb3 100644 --- a/gcc/fortran/scanner.c +++ b/gcc/fortran/scanner.c @@ -1556,6 +1556,7 @@ restart: not_continuation: c = '\n'; gfc_current_locus = old_loc; + end_flag = 0; done: if (c == '\n') diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ed80db55d44..49789988c96 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-23 Jerry DeLisle + + PR fortran/66461 + * gfortran.dg/unexpected_eof.f: New test + 2016-05-23 Michael Meissner Kelvin Nilsen diff --git a/gcc/testsuite/gfortran.dg/unexpected_eof.f b/gcc/testsuite/gfortran.dg/unexpected_eof.f new file mode 100644 index 00000000000..d3cdb99596a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/unexpected_eof.f @@ -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 } -- 2.30.2