Discussion:
[Freetel-codec2] array subscript is above array bounds
Steve
2016-09-18 01:51:21 UTC
Permalink
Not a very useful posting, but I found an old style C bug in my encoder
translation. This reduced my bad data by quite a bit, but there is still
some persistent errors yet.

Anyway:

#include <stdio.h>

static int snr[4];

int main() {
int big = 40;

snr[big] = 7;
fprintf(stderr, "snr[%d] = %d\n", big, snr[big]);

return 0;
}

If you run this it will print:

snr[40] = 7

Ha, anyway, I haven't made this error in years. So I tried:

-mpx -fcheck-pointer-bounds

as added switches on GCC and it did flag the warning. One major bug down,
one left... argh...

Loading...