From 1cfc6f00e45104551da9146bb413b60acd0e387f Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 13 Apr 2021 16:00:10 +0930 Subject: [PATCH] PR27722, error: array subscript has type char PR 27722 * libdep_plugin.c (str2vec): Don't pass a potentially signed char to isspace. --- ld/ChangeLog | 6 ++++++ ld/libdep_plugin.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ld/ChangeLog b/ld/ChangeLog index c862e8b13ae..e7620ce0417 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2021-04-13 Alan Modra + + PR 27722 + * libdep_plugin.c (str2vec): Don't pass a potentially signed char + to isspace. + 2021-04-12 Alan Modra * configure.ac (--enable-checking): Add support. diff --git a/ld/libdep_plugin.c b/ld/libdep_plugin.c index 7c108e4de8d..5130c6f664b 100644 --- a/ld/libdep_plugin.c +++ b/ld/libdep_plugin.c @@ -139,7 +139,7 @@ str2vec (char *in) end = in + strlen (in); s = in; - while (isspace (*s)) s++; + while (isspace ((unsigned char) *s)) s++; first = s; i = 1; @@ -163,12 +163,12 @@ str2vec (char *in) memmove (s, s+1, end-s-1); end--; } - if (isspace (*s)) + if (isspace ((unsigned char) *s)) { if (sq || dq) continue; *s++ = '\0'; - while (isspace (*s)) s++; + while (isspace ((unsigned char) *s)) s++; if (*s) res[++i] = s; } -- 2.30.2