[PATCH][fortran] Fix PR24176
Richard Guenther
rguenther@suse.de
Wed Oct 5 09:25:00 GMT 2005
On Tue, 4 Oct 2005, Richard Guenther wrote:
>
> This fixes the ICE-on-empty-file.
>
> Ok for mainline/4.0?
Approved by Steve Kargl, this is what I'm going to commit
(stevenb suggested to use something more appropriate than
testing gfc_current_locus.nextc).
Richard.
2005-10-05 Richard Guenther <rguenther@suse.de>
* parse.c (gfc_parse_file): Exit early for empty files.
* gfortran.fortran-torture/compile/empty.f90: New testcase.
Index: fortran/parse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/parse.c,v
retrieving revision 1.31
diff -c -3 -p -r1.31 parse.c
*** fortran/parse.c 17 Sep 2005 18:58:00 -0000 1.31
--- fortran/parse.c 4 Oct 2005 08:33:30 -0000
*************** gfc_parse_file (void)
*** 2560,2565 ****
--- 2560,2569 ----
seen_program = 0;
+ /* Exit early for empty files. */
+ if (gfc_at_eof ())
+ goto done;
+
loop:
gfc_init_2 ();
st = next_statement ();
More information about the Fortran
mailing list