This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[patch, fortran] PR30779 incomplete file triggers ICE
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 14 Feb 2007 22:22:17 -0800
- Subject: [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