From: Aschref Ben Thabet <aschref.ben-tha...@embedded-brains.de> The warning may be because you're passing a char to the isspace() macro. The implementation of isspace() may be via array indexing. (The argument to the isspace()/isdegit() macro is defined to be an unsigned char the value of which can fit in an unsignedchar).
at ctype.h in GNU libc, and while there's a complicated mess of macros and functions, somewhere in the definition of isspace() there's an array being indexed. See if isspace((unsigned char) *str) gets rid of the warning. The s[r + b] is very likely a bug, because the type char can be signed or unsigned—it's up to the compiler. If char is signed, then it's possible for c to be negative, in which case accessing a negative array index leads to Undefined Behavior. --- cpukit/libdl/rtl-archive.c | 4 ++-- cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cpukit/libdl/rtl-archive.c b/cpukit/libdl/rtl-archive.c index eb7641b034..8f280157ff 100644 --- a/cpukit/libdl/rtl-archive.c +++ b/cpukit/libdl/rtl-archive.c @@ -516,13 +516,13 @@ rtems_rtl_archives_load_config (rtems_rtl_archives* archives) { size_t ls = strlen (&s[r]); size_t b = 0; - while (b < ls && isspace (s[r + b])) + while (b < ls && isspace((unsigned char)(s[r + b]))) { s[r + b] = '\0'; ++b; } b = ls - 1; - while (b > 0 && isspace (s[r + b])) + while (b > 0 && isspace((unsigned char)(s[r + b]))) { s[r + b] = '\0'; --b; diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c index 32c9c6e17e..30002bc804 100644 --- a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c +++ b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c @@ -338,7 +338,7 @@ rtems_fdt_shell_set (int argc, char *argv[]) if (!rtems_fdt_get_value32 (argv[1], "reg", sizeof (uint32_t), &address)) return 1; - if (isdigit((int)argv[mask_arg][0])) + if (isdigit((unsigned char)argv[mask_arg][0])) mask = strtoul (argv[mask_arg], 0, 0); else { -- 2.26.2 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel