This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH][fortran] Fix PR24176
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: fortran at gcc dot gnu dot org
- Date: Wed, 5 Oct 2005 11:15:26 +0200 (CEST)
- Subject: Re: [PATCH][fortran] Fix PR24176
- References: <Pine.LNX.4.58.0510041035360.26716@wotan.suse.de>
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 ();