I find this array bound check too hard:
./compiler/gcc-4.8.0-snap/bin/gcc c1.c -O3 -c -Wall
c1.c: In function main:
c1.c:15:22: warning: array subscript is above array bounds
[-Warray-bounds]
if (!ab_pid[index])
^
extern unsigned char ab_pid_count,old_rfcb_pid_count;
extern unsigned short ab_pid[16];
extern int found_pid;
int main()
{
unsigned char pid_index = 0;
int index;
for (pid_index=0; (pid_index < old_rfcb_pid_count); pid_index++)
{
for (index=0; index < ab_pid_count; index++)
{
if (!ab_pid[index])
{
found_pid = 1;
}
};
}
return 0;
}
Does this mean we have to rework the loops like 'index < ab_pid_count &&
index < 16' ? But if so, why does the warning disappear without the
outer loop or with ' unsigned short ab_pid[32]'?
Regards.