aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/parse.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2005-10-05 09:38:29 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2005-10-05 09:38:29 +0000
commitc82cdb5dfc2b9e85dbe577e32d73dc8fd6062afe (patch)
tree034cc559b3d9cde4cc25da4ee9c8b410d2600533 /gcc/fortran/parse.c
parent1767cc4fa9f79b88c8dbde260e1fc16101a937e4 (diff)
downloadgcc-c82cdb5dfc2b9e85dbe577e32d73dc8fd6062afe.zip
gcc-c82cdb5dfc2b9e85dbe577e32d73dc8fd6062afe.tar.gz
gcc-c82cdb5dfc2b9e85dbe577e32d73dc8fd6062afe.tar.bz2
re PR fortran/24176 (gfortran segfaults on empty source)
2005-10-05 Richard Guenther <rguenther@suse.de> PR fortran/24176 * parse.c (gfc_parse_file): Exit early for empty files. * gfortran.fortran-torture/compile/empty.f90: New testcase. From-SVN: r104984
Diffstat (limited to 'gcc/fortran/parse.c')
-rw-r--r--gcc/fortran/parse.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 1e28a7e..043c3b4 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 ();