Wind River Support Network

HomeDefectsLIN6-10678
Fixed

LIN6-10678 : Array subscript is above array bounds

Created: Aug 21, 2015    Updated: Dec 3, 2018
Resolved Date: Mar 9, 2016
Previous ID: TCWRLGCC-43
Found In Version: 6.0.0.13
Fix Version: 6.0.0.29
Severity: Standard
Applicable for: Wind River Linux 6
Component/s: Toolchain

Description

Wrong warnings "array subscript is above array bounds" are generated when compiling the given test case.

warning: array subscript is above array bounds [-Warray-bounds]

Steps to Reproduce

1. Create a "test.c" file like the following:
/* test.c */
unsigned baz[6]; 
void test(unsigned *bar, unsigned n) {
     unsigned i, j;
     if (n > 6) {
          n = 6;
     }
     for (i = 1; i < n; i++) {
          for (j = i - 1; j > 0; j--) {
               bar[j - 1] = baz[j - 1];
          }
     }
}
2. # $CC -m64 -O3 -S -Wall ~/test.c -o ~/test.o
warning: array subscript is above array bounds [-Warray-bounds]

Other Downloads


Live chat
Online