Why do I get a false "array subscript is above array bounds" warning message when compiling my MEX file with GCC on MATLAB 7.10 (R2010a)?
Show older comments
When I compile the following code:
typedef struct {
int chunks[3];
} S;
void f(int y[])
{
int nc;
int i = 0;
for (nc = 0; nc < 3; nc = nc + 1) {
i = i + 1;
}
if (i < 3) {
y[i] = 0;
}
}
int main(void)
{
S tmp;
f(tmp.chunks);
return 0;
}
with this command:
gcc -Wall -O3 s3.c
I get the following warning message:
s3.c: In function 'main':
s3.c:15: warning: array subscript is above array bounds
Accepted Answer
More Answers (0)
Categories
Find more on MATLAB Compiler in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!