Wind River Support Network

HomeDefectsLIN7-5764
Fixed

LIN7-5764 : CLONE - Array subscript is above array bounds

Created: Mar 10, 2016    Updated: Sep 8, 2018
Resolved Date: May 31, 2016
Found In Version: 7.0
Fix Version: 7.0.0.17
Severity: Standard
Applicable for: Wind River Linux 7
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