Hello Florent!
I've finally managed to look into the problem and it has
turned out to be a bug in the CVI compiler. I've reported
and fixed it for the next version of CVI. Thanks for finding
the problem!
The compiler incorrectly propagated information about
uninitialized local variables from band_index to
StdSwSpecLim. If StdSwSpecLim was a local variable this
would be correct, because it allows CVI to detect when
you're accessing an uninitialized array element. But it's
incorrect to do this for global variables, and
misinterpreting the information later on causes the
incorrect runtime error.
I don't want to go into too much detail here, but this bug
also explains the odd behavior of CVI when calling memcpy().
As you've already noted,
the best way to work around the
problem is to initialize band_index at its declaration.
Thanks again for finding the problem!
Peter
-- Peter Ilberg