[Bug c/39841] New: -Wall on 'signed char' array subscript
ebb9 at byu dot net
gcc-bugzilla@gcc.gnu.org
Tue Apr 21 21:46:00 GMT 2009
I appreciate the fact that gcc is able to warn about misuse of <ctype.h> macros
when they are written as an array access, when the programmer mistakenly uses
'char' (under -fsigned-char) instead of the standard-mandated int containing an
unsigned char value (there is discussion right now on the newlib list about
rewriting isalpha and friends in a manner more conducive to triggering this
warning, http://sourceware.org/ml/newlib/2009/msg00511.html).
However, I expected that gcc would also warn about 'signed char':
$ cat foo.c
signed char ch;
int array[1];
int main ()
{
return array[ch];
}
$ gcc -Wall -c -o foo.o foo.c -Dsigned=
foo.c: In function 'main':
foo.c:5: warning: array subscript has type 'char'
$ gcc -Wall -c -o foo.o foo.c
$
--
Summary: -Wall on 'signed char' array subscript
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ebb9 at byu dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39841
More information about the Gcc-bugs
mailing list