In the attatched code the file master.c is compiled as
**** Build of configuration Debug for project prjprbl ****
"C:\\ti\\CCV5p5\\ccsv5\\utils\\bin\\gmake" -k master.obj
'Building file: D:/Data_D/TI_problems/Prj_probl/SRC/master.c'
'Invoking: C2000 Compiler'
"C:/Program Files (x86)/Texas Instruments/C2000 Code Generation Tools 6.2.4/bin/cl2000" -v28 -ml -mt --cla_support=cla0 --float_support=fpu32 -O2 --include_path="C:/Program Files (x86)/Texas Instruments/C2000 Code Generation Tools 6.2.4/include" --include_path="D:/Data_D/TI_problems/Prj_probl/UserApp" -g --define=LARGE_MODEL --diag_warning=225 --display_error_number --diag_suppress=880 --diag_suppress=552 --issue_remarks -k --asm_listing --output_all_syms --misra_advisory=warning --misra_required=warning --preproc_with_compile --preproc_dependency="master.pp" "D:/Data_D/TI_problems/Prj_probl/SRC/master.c"
'Finished building: D:/Data_D/TI_problems/Prj_probl/SRC/master.c'
' '
**** Build Finished ****
The lines 90--91
//START{PROBLEM}
// here is the problem: UShorts[2] will be zeroed finally by assignment to ULongs[1]
P_xx->
pattern.ULongs[1] = 0;
P_xx->
pattern.UShorts[2] = P_xx->YYYsegmentedData[0];
//END{PROBLEM}
are compiled into (see master.asm)
.dwpsn file "D:/Data_D/TI_problems/Prj_probl/SRC/master.c",line 90,column 12,is_stmt
MOV32 XAR4,R5H ; [CPU_] |90|
MOVL XAR7,XAR3 ; [CPU_] |90|
MOVB XAR6,#0 ; [CPU_] |90|
.dwpsn file "D:/Data_D/TI_problems/Prj_probl/SRC/master.c",line 91,column 12,is_stmt
MOV AL,*XAR7 ; [CPU_] |91|
MOV *+XAR4[2],AL ; [CPU_] |91|
MOV32 XAR4,R4H ; [CPU_] |91|
.dwpsn file "D:/Data_D/TI_problems/Prj_probl/SRC/master.c",line 90,column 12,is_stmt
MOVL *+XAR4[2],XAR6 ; [CPU_] |90|
and the last move of xar6 clears the valid result of mov AL.
Indeed, this is the work of the optimizer and if you try to change the source and remove some rows, the compiler perform it in a better way.
Thanks