https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66466

            Bug ID: 66466
           Summary: Spurious "warning: array subscript has type 'char'"
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrewthompson10 at gmail dot com
  Target Milestone: ---

Created attachment 35720
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35720&action=edit
Source file that caused the warning above

I got a spurious warning from this code using GCC 4.9.2 on Cygwin. I tried
various subscripts, but they didn't change anything. Placing a typecast fixed
it: isspace((int)s[42]);


The source code is attached. This is the command-line I used to compile:

$ gcc -Wall tmp.c
tmp.c: In function ‘main’:
tmp.c:9:2: warning: array subscript has type ‘char’ [-Wchar-subscripts]
  int i = isspace(s[42]);
  ^



Thanks for your work on GCC.

Reply via email to