I have ran into a bug with loops and array assignment with type casting. The program below crashes. The debugger is set to full information and optimizations are disabled. The compiler version is 6.00.4
Any suggestions you have will be appreciated!
******CODE******
#define VGN_POINTS 8
int main(int argc, char *argv[])
{
int loop; // Generic loop variable
float vgn_multiplier;
long VGN_normalized_i[VGN_POINTS]; //!< Normalized VGN measurement according to DS-S4-1-3-1_A(PR2)
long VGN_data[VGN_POINTS];
// Perform vgn_multiplier code once, as the value doesn't change during
// the normalization FOR loop
vgn_multiplier = 0.84f;
VGN_data[0] = 6;
VGN_data[1] = 226;
VGN_data[2] = 302;
VGN_data[3] = 445;
VGN_data[4] = 608;
VGN_data[5] = 784;
VGN_data[6] = 988;
VGN_data[7] = 1213;
for(loop = 0; loop<VGN_POINTS; loop++)
{
VGN_normalized_i[loop] = (long)(vgn_multiplier * (float)VGN_data[loop]);
}
return 0;
}