I'm using CCS version 6.1.1.00022 with compiler v7.4.17 on an OMAP L138.
I have the optimizer turned on for my whole project on level 3. For the advanced optimizer options for speed at '4'. I've noticed that one particular loop in one file causes a failure with the optimizer on (A portion of the array written is zeroed). If I turn off the optimizer for this file, the loop functions as expected. I've attached the loop I've found below:
uint8_T rtb_HexbitstoInteger[12]; uint8_T rtb_RSEncoder241213[24]; typedef struct { int32_T B[12]; } DW_long_terminator_f_T; DW_long_terminator_f_T *localDW; for (i = 0; i < 12; i++) { rtb_RSEncoder241213[i] = rtb_HexbitstoInteger[i]; rtb_RSEncoder241213[i + 12] = (uint8_T)localDW->B[i]; } Log_print3(Diags_USER1, "after: %d %d %d", rtb_RSEncoder241213[12+0], rtb_RSEncoder241213[12+6], rtb_RSEncoder241213[12+11]);
I suspect that the context in the file is important, so I've attached the file in question. This loop starts on line 164. With the optimizer turned ON, my log print shows all zeros. With the optimizer turned OFF the log print will show valid values. If I insert a Log_print statement between the two lines in the loop, the loop functions as expected and the output array has valid values.
I guess I have a workaround for now (unoptimizing this file), but I'm curious if there's any more testing I can do or if this is a known problem?