NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/51831: ctype misuse no longer reported by gcc



>Number:         51831
>Category:       toolchain
>Synopsis:       ctype misuse no longer reported by gcc
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 11 19:10:00 +0000 2017
>Originator:     David A. Holland
>Release:        NetBSD 7.99.44 (20161208)
>Organization:
>Environment:
System: NetBSD macaran 7.99.44 NetBSD 7.99.44 (MACARAN) #40: Thu Dec  8 17:57:53 EST 2016  dholland@macaran:/usr/src/sys/arch/amd64/compile/MACARAN amd64
Architecture: x86_64
Machine: amd64
>Description:

Use of the <ctype.h> functions without casting to unsigned char no
longer triggers a warning in gcc. Not sure if this is because of gcc 5
or because of header changes; strings shows the warning is still in
/usr/libexec/cc1, and the current headers look like they should
trigger the warning (and do with a non-netbsd gcc 4.8.3 bin I had
lying around)... but they don't.

>How-To-Repeat:

Compile this with -Wall -W and note the absence of
foo.c:7:7: warning: array subscript has type 'char' [-Wchar-subscripts]
   ------
#include <ctype.h>

int foo(const char *s) {
   unsigned i;

   for (i=0; s[i]; i++) {
      if (isupper(s[i])) {
         return 1;
      }
   }
   return 0;
}
   ------

>Fix:

dunno.



Home | Main Index | Thread Index | Old Index