Commit 3c917358 by Tobias Burnus Committed by Tobias Burnus

[Fortran] PR 92072 – fix %C corner case

        PR fortran/92072
        * error.c (error_print, gfc_format_decoder): Fix %C column-
        offset handling.

From-SVN: r276953
parent 63d25773
2019-10-14 Tobias Burnus <tobias@codesourcery.com>
PR fortran/92072
* error.c (error_print, gfc_format_decoder): Fix %C column-
offset handling.
2019-10-13 Damian Rouson <damain@sourceryinstitue.org>
PR fortran/91513
......@@ -110,7 +116,8 @@
2019-10-04 Tobias Burnus <tobias@codesourcery.com>
* error (error_print, gfc_format_decoder): Fix off-by one issue with %C.
* error.c (error_print, gfc_format_decoder): Fix off-by one issue
with %C.
2019-10-03 Steven G. Kargl <kargl@gcc.gnu.org>
......
#pragma GCC optimize("O0")
/* Handle errors.
Copyright (C) 2000-2019 Free Software Foundation, Inc.
Contributed by Andy Vaught & Niels Kristian Bech Jensen
......@@ -619,7 +620,7 @@ error_print (const char *type, const char *format0, va_list argp)
l2 = loc;
arg[pos].u.stringval = "(2)";
/* Point %C first offending character not the last good one. */
if (arg[pos].type == TYPE_CURRENTLOC)
if (arg[pos].type == TYPE_CURRENTLOC && *l2->nextc != '\0')
l2->nextc++;
}
else
......@@ -628,7 +629,7 @@ error_print (const char *type, const char *format0, va_list argp)
have_l1 = 1;
arg[pos].u.stringval = "(1)";
/* Point %C first offending character not the last good one. */
if (arg[pos].type == TYPE_CURRENTLOC)
if (arg[pos].type == TYPE_CURRENTLOC && *l1->nextc != '\0')
l1->nextc++;
}
break;
......@@ -969,7 +970,7 @@ gfc_format_decoder (pretty_printer *pp, text_info *text, const char *spec,
loc = va_arg (*text->args_ptr, locus *);
gcc_assert (loc->nextc - loc->lb->line >= 0);
unsigned int offset = loc->nextc - loc->lb->line;
if (*spec == 'C')
if (*spec == 'C' && *loc->nextc != '\0')
/* Point %C first offending character not the last good one. */
offset++;
/* If location[0] != UNKNOWN_LOCATION means that we already
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment