[patch, fortran] PR27954 ICE on garbage in DATA statement

Jerry DeLisle jvdelisle@verizon.net
Sat Oct 21 07:30:00 GMT 2006


:ADDPATCH fortran:

The attached patch, developed with the assistance of Paul Thomas, avoids several 
internal errors by removing the data symbols from namespace->data created before 
syntax errors occurred. This was leaving symbols with no names or no types which 
choked gfc_resolve in one way or another.

I created a new function to consolidate the simple code Paul came up with and 
applied it in the error paths at three different places.  I have not reviewed 
for other places where similar things may be happening.  I can maybe do that 
some other time.  Its not too critical since these are internal errors on 
invalid code anyway.

Also fixed incorrect text in one of the internal error messages that could throw 
you off a bit.  It was giving the wrong name of the function the error was in.

The three test cases provided gave three different internal errors on 
i686-linux.  One on a bad symbol, one on a bad type, and one segfault.

Regression tested on i686-linux.  I would not count on consistent error messages 
before the patch. :)

OK for 4.3 I presume when that trunk is open?

Regards,

Jerry

2006-10-20  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	PR fortran/27954
	* decl.c (gfc_free_data_all): New function to free all data structures
	after errors in DATA statements and declarations.
	(top_var_list): Use new function.
	(top_val_list): Use new function.
	(gfc_match_data_decl): Use new function.
	* misc.c (gfc_typename): Fixed incorrect function name in error text.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: error_recovery_2.f90
Type: text/x-fortran
Size: 267 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061021/ac181617/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error_recovery_3.f90
Type: text/x-fortran
Size: 293 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061021/ac181617/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: error_recovery_4.f90
Type: text/x-fortran
Size: 338 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061021/ac181617/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr27954b.diff
Type: text/x-patch
Size: 2862 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061021/ac181617/attachment-0003.bin>


More information about the Fortran mailing list