http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53198

             Bug #: 53198
           Summary: [4.6 Regression] gcc wrongly emits "array subscript is
                    above array bounds" for simple arrays
    Classification: Unclassified
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: vap...@gentoo.org
                CC: toolch...@gentoo.org
            Target: x86_64-linux-gnu


simple code that processes arrays based on NULL terminator rather than
ARRAY_SIZE

$ cat test.c
void *devices[] = { 0, };
int main()
{
        int i;
        for (i = 0; devices[i]; i++)
                ;
        return 0;
}

$ gcc -Warray-bounds -O2 test.c 
test.c: In function 'main':
test.c:5:21: warning: array subscript is above array bounds [-Warray-bounds]

looks like it started failing with 4.6.0 ... older versions are fine.

Reply via email to