[patch]

François-Xavier Coudert fxcoudert@gmail.com
Wed May 10 10:44:00 GMT 2006


:ADDPATCH fortran:

I tried to understand PR 24549
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24549), an ICE after
error recovery. We see a statement we don't understand, we skip to the
next and there is the ICE, because we use a value for gfc_new_block
that has been freed (it was allocated for the last statement). I don't
see any reason why, in reject_statement(), we don't set gfc_new_block
= NULL, leading to the following patch:

Index: parse.c
===================================================================
--- parse.c     (revision 113603)
+++ parse.c     (working copy)
@@ -1292,7 +1292,7 @@
 static void
 reject_statement (void)
 {
-
+  gfc_new_block = NULL;
   gfc_undo_symbols ();
   gfc_clear_warning ();
   undo_new_statement ();


So, I'd like to know, from someone who's accustomed to gfortran error
recovery mechanism, if there is a reason for not setting clearing
gfc_new_block. And, if not, is the above patch approved (I'll add a
testcase and the obvious ChangeLog entries, of course).

Thanks,
FX

PS: I know this is patch submission is not in very good order, but I'm
at work and it's such a simple patch, I couldn't keep it for later.



More information about the Gcc-patches mailing list