No type checking in ctype builtins
Jonathan Wakely
jwakely.gcc@gmail.com
Wed Apr 27 16:19:21 GMT 2022
On Wed, 27 Apr 2022 at 16:29, Andrea Monaco via Gcc <gcc@gcc.gnu.org> wrote:
>
>
> This program
>
> #include <ctype.h>
>
> int main ()
> {
> char *s;
> isspace (s);
> }
>
> compiles with no warning in gcc 8.3.0, even though there's a type
> mistake; the correct call would be isspace (*s).
N.B. The correct call would be isspace((unsigned char)*s) because
isspace has undefined behaviour if you pass it a char with a negative
value.
It would be nice if GCC warned about *that*.
More information about the Gcc
mailing list