I'm using MDK303Beta2 to debug UCOS-II on LM3S MCU. At different optimization level of C/C++, diferent asm instructions will be used to build a C instrction, but sometime, the asm intstructions access inexistent RAM spcace and Fault exception occurs. For example, there are 3 lines of C: Queue->NData = 0; Queue->ReadEmpty = Empty; Queue->WriteFull = Full; If I select "Optimization" to Level 1, it will be MOVS R1, #0x00 STRH R1, [R4, #0x0C] STR R5, [R4, #0x10] STR R5, [R4, #0x14] It's fine, no error. But if I select "Optimization" to the other levels(0,2,3), same asm instructions will be use: STRD R1, R2, [R4, #0x04] MOVS R1, #0x00 STRH R1, [R4, #0x0C] when STRD excuted, fault exception occurs. And "Level 1" is not always ok, as the code becomes biger and biger, sometime level 0 ok, soemtime level 3...Sometime compiler ignores something, like for "Prio>>3", sometime shifting right is omited, "Prio" is used directly in the following.