* Andreas Schwab:

> On Apr 27 2022, Andrea Monaco via Gcc 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).
>
> Try -Wsystem-headers.
>
>> The ctype functions are implemented as macros in glibc, so you can't
>> have type checking.  But they are also provided as builtins by gcc, so I
>> wonder why type checking is not performed in that case, either.
>
> You need to suppress the macro to get the builtin.

Shouldn't that happen automatically with -O2?

I think it's a header bug, we don't use inline functions in C mode, only
in C++ mode:

#ifndef __cplusplus
# define __isctype(c, type) \
  ((*__ctype_b_loc ())[(int) (c)] & (unsigned short int) type)
#elif defined __USE_EXTERN_INLINES
# define __isctype_f(type) \
  __extern_inline int                                                         \
  is##type (int __c) __THROW                                                  \
  {                                                                           \
    return (*__ctype_b_loc ())[(int) (__c)] & (unsigned short int) _IS##type; \
  }
#endif

Thanks,
Florian

Reply via email to