2005-10-05 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Oct 2005 09:38:29 +0000 (09:38 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 Oct 2005 09:38:29 +0000 (09:38 +0000)
PR fortran/24176
* parse.c (gfc_parse_file): Exit early for empty files.

* gfortran.fortran-torture/compile/empty.f90: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@104984 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/parse.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.fortran-torture/compile/empty.f90 [new file with mode: 0644]

index 0ee880d..5663b31 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-05  Richard Guenther  <rguenther@suse.de>
+
+       PR fortran/24176
+       * parse.c (gfc_parse_file): Exit early for empty files.
+
 2005-10-03  Steve Ellcey  <sje@cup.hp.com>
 
        * fortran/trans-types.c (gfc_init_kinds): Only pass float, double,
index 1e28a7e..043c3b4 100644 (file)
@@ -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 ();
index 6790aa8..b24ca2c 100644 (file)
@@ -1,3 +1,8 @@
+2005-10-05  Richard Guenther  <rguenther@suse.de>
+
+       PR fortran/24176
+       * gfortran.fortran-torture/compile/empty.f90: New testcase.
+
 2005-10-05  Nathan Sidwell  <nathan@codesourcery.com>
 
        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 (file)
index 0000000..e69de29