Wind River Support Network

HomeDefectsLIN8-3976
Fixed

LIN8-3976 : CLONE - Array subscript is above array bounds

Created: Jun 19, 2016    Updated: Dec 3, 2018
Resolved Date: Oct 27, 2016
Found In Version: 8.0
Fix Version: 8.0.0.11
Severity: Standard
Applicable for: Wind River Linux 8
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