[patch, fortran] PR77972 ICE on broken character continuation with -Wall etc.

Jerry DeLisle jvdelisle@charter.net
Fri Oct 14 03:18:00 GMT 2016


This patch is straight forward. We were sending bogus locus info to the 
diagnostics machinery and catch an assert in error,c.

The patch avoids doing this.

Regression tested on x86-64-linux.

OK for trunk?

Regards,

Jerry

2016-10-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>

	* scanner.c (gfc_next_char_literal): If nextc is null do not
	decrement the pointer and call the diagnostics.

diff --git a/gcc/fortran/scanner.c b/gcc/fortran/scanner.c
index be9c5091..5e355359 100644
--- a/gcc/fortran/scanner.c
+++ b/gcc/fortran/scanner.c
@@ -1414,10 +1414,9 @@ restart:

        if (c != '&')
         {
-         if (in_string)
+         if (in_string && gfc_current_locus.nextc)
             {
-             if (gfc_current_locus.nextc)
-               gfc_current_locus.nextc--;
+             gfc_current_locus.nextc--;
               if (warn_ampersand && in_string == INSTRING_WARN)
                 gfc_warning (OPT_Wampersand,
                              "Missing %<&%> in continued character "



More information about the Fortran mailing list