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

Steve Kargl sgk@troutmask.apl.washington.edu
Fri Oct 14 03:18:00 GMT 2016


On Thu, Oct 13, 2016 at 07:04:04PM -0700, Jerry DeLisle wrote:
> 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?
> 

Yes, but see below.

> 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 "

If this is a "missing '&' in a continued..." and the '&' is 
required by the standard, then why is this just a warning?

-- 
Steve



More information about the Gcc-patches mailing list