diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 0ee880d6a2f..5663b315bc9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2005-10-05 Richard Guenther + + PR fortran/24176 + * parse.c (gfc_parse_file): Exit early for empty files. + 2005-10-03 Steve Ellcey * fortran/trans-types.c (gfc_init_kinds): Only pass float, double, diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c index 1e28a7e090c..043c3b49e0a 100644 --- a/gcc/fortran/parse.c +++ b/gcc/fortran/parse.c @@ -2560,6 +2560,10 @@ gfc_parse_file (void) seen_program = 0; + /* Exit early for empty files. */ + if (gfc_at_eof ()) + goto done; + loop: gfc_init_2 (); st = next_statement (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6790aa87479..b24ca2cbfed 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-10-05 Richard Guenther + + PR fortran/24176 + * gfortran.fortran-torture/compile/empty.f90: New testcase. + 2005-10-05 Nathan Sidwell PR c++/23513 diff --git a/gcc/testsuite/gfortran.fortran-torture/compile/empty.f90 b/gcc/testsuite/gfortran.fortran-torture/compile/empty.f90 new file mode 100644 index 00000000000..e69de29bb2d