This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][fortran] Fix PR24176


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 ();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]