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]

[patch, fortran] PR30779 incomplete file triggers ICE


:ADDPATCH fortran:

Hi All,

This trivial patch checks if an end of file occurred after the advance_line is called. The ICE results when trying to access a locus which is NULL in this situation. The solution is to simply jump out. Allowing other error processing to occur.

Regression tested on x86-64 Linux.

I will commit to trunk under the obvious rule.

Regards,

Jerry


2007-02-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>


	PR fortran/30779
	* scanner.c (gfc_next_char_literal): Add check for end of file after
	call to advance_line.

! { dg-do compile }
! PR30779 incomplete file triggers ICE.
! Note: This file is deliberately cut short to verify a graceful exit. Before
! the patch this gave ICE.
MODULE M1
 INTEGER :: I
END MODULE M1

USE M1,                    ONLY: I,&! { dg-error "Missing" }
Index: scanner.c
===================================================================
*** scanner.c	(revision 121975)
--- scanner.c	(working copy)
*************** restart:
*** 704,709 ****
--- 704,712 ----
  	skip_comment_line ();
        else
  	gfc_advance_line ();
+       
+       if (gfc_at_eof())
+ 	goto not_continuation;
  
        /* We've got a continuation line.  If we are on the very next line after
  	 the last continuation, increment the continuation line count and

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