I think I found a compiler bug in CG Tools v7.4.14 when using -O2 on a C6678 CPU. It can be reproduced with the following test code:
void test() { unsigned char Buffer[64]; int i; for (i=0; i<64; i++) { int pos = i%8; if (pos < 3) Buffer[3*(i/8)+pos] = i; } while (1) printf("%u\n", Buffer[0]); }
When calling this function, the for() loop spins forever and the printf() line is never reached. The problem goes away after remove the while(1) line.
Thanks,
Ralf