From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31826 invoked by alias); 21 Apr 2009 21:46:33 -0000 Received: (qmail 31749 invoked by uid 48); 21 Apr 2009 21:46:18 -0000 Date: Tue, 21 Apr 2009 21:46:00 -0000 Subject: [Bug c/39841] New: -Wall on 'signed char' array subscript X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ebb9 at byu dot net" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2009-04/txt/msg01869.txt.bz2 I appreciate the fact that gcc is able to warn about misuse of 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