[Patch, Fortran] PR57895 - avoid segfault and improve diagnostic

Tobias Burnus burnus@net-b.de
Wed Jul 17 10:36:00 GMT 2013


Without this patch, GCC 4.3 and later segfault. As Mikael wrote: 
"gfc_restore_last_undo_checkpoint seems to take care of the cleanup, so 
we don't need to do it in gfc_match_common."

Additionally, this patch ensures that the error message about the "$" 
gets printed - without the change, it doesn't. Initially I had 
gfc_error_now instead of gfc_fatal_error. However, that gave tons of 
nonhelpful errors for the original test case - and for the test case in 
this patch, it prints the same message around twenty times. Hence, 
gfc_fatal_error is much more reasonable - even if the test case then no 
longer checks for the double free.

Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias

PS: Formally, it would qualify as regression as GCC 4.1 doesn't crash 
but prints "Syntax error in COMMON statement". Thus, if any one prefers, 
we could also backport the patch to the maintained branches.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dollar-err.diff
Type: text/x-patch
Size: 2555 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130717/cc61f2b7/attachment.bin>


More information about the Fortran mailing list