This is the mail archive of the mailing list for the GCC 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]

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

Le 17/07/2013 12:36, Tobias Burnus a écrit :
> 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.
Well, once the segfault is fixed, it does get printed here. On the other

> 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.
... avoiding the many duplicate errors is indeed more reasonable.

May I suggest adjusting the error locus one character back by the way:

--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -556,8 +556,8 @@ gfc_match_name (char *buffer)

   if (c == '$' && !gfc_option.flag_dollar_ok)
-      gfc_fatal_error ("Invalid character '$' at %C. Use -fdollar-ok to
allow "
-		       "it as an extension");
+      gfc_fatal_error ("Invalid character '$' at %L. Use -fdollar-ok to
allow "
+		       "it as an extension", &old_loc);
       return MATCH_ERROR;

The patch is OK in any case. Thanks.


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