On Wed, Apr 27, 2022 at 12:20 PM Jonathan Wakely via Gcc
<gcc@gcc.gnu.org> wrote:
>
> 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*.

Related bugs:
78155: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78155
99950: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99950

Reply via email to