[Bug libfortran/95177] error: array subscript has type char

fxcoudert at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Dec 16 17:39:11 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95177

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu.org

--- Comment #16 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
I feel like the "array subscript has type char" error is really a red herring
in this case. What really matters is the following: throughout libgfortran, we
are calling functions from <ctype.h> that should only be called on values that
can be represented by unsigned char, with char arguments. On targets where char
is a signed type, this will could lead to undefined behaviour for some values.
Because the functions are sometimes called on user-provided strings (strings,
string formats, etc) we cannot guarantee that the strings will not contain
ASCII only. So we have to solve this issue.

The four functions currently used in libgfortran are: isalnum, isdigit,
tolower, toupper. Patch incoming.


More information about the Gcc-bugs mailing list