Hello,
I am experiencing some strange behavior in my program running on a C6748 (L-138 EVM board). There's an IF that appears not to be working properly:
(line 555) if(verify_sync_pulse(&sig_buf_rx_fs, index_max, &sync1)!=PLM_OK){
return plm_error=SYNC_MISSING;
}
(Sorry, I could not figure how to format code properly)
The part of the listing file that matches the code above is this, I think:
3307 .dwpsn file "plm.c",line 555,column 3,is_stmt
3308 $C$DW$317 .dwtag DW_TAG_TI_branch
3309 .dwattr $C$DW$317, DW_AT_low_pc(0x00)
3310 .dwattr $C$DW$317, DW_AT_name("_verify_sync_pulse")
3311 .dwattr $C$DW$317, DW_AT_TI_call
3312 00000d08 0FFE6710 CALL .S1 _verify_sync_pulse ; |555|
3313 00000d0c 023C22E6 LDW .D2T2 *+SP(4),B4 ; |555|
3314 00000d10 0186902A' MVKL .S2 $C$RL90,B3 ; |555|
3315 00000d14 0180006A' MVKH .S2 $C$RL90,B3 ; |555|
3316 00000d18 033D1058 ADD .L1X 8,SP,A6 ; |555|
3317 00000d1c 02280058 MV .L1 A10,A4 ; |555|
3318 00000d20 $C$RL90: ; CALL OCCURS {_verify_sync_pulse} {0} ; |555|
3319 ;** --------------------------------------------------------------------------*
3320 00000d20 00900058 MV .L1 A4,A1 ; |555|
3321 .dwpsn file "plm.c",line 556,column 5,is_stmt
3322 00000d24 80006410 [ A1] B .S1 $C$L27 ; |556|
3323 00000d28 820009AA [ A1] MVK .S2 19,B4 ; |556|
3324 00000d2c 860009A8 [ A1] MVK .S1 0x13,A12 ; |556|
3325 00000d30 8200057E- [ A1] STW .D2T2 B4,*+DP(_plm_error) ; |556|
3326 00000d34 00002000 NOP 2
3327 ; BRANCHCC OCCURS {$C$L27} ; |556|
The above is compiled with optimization options: (optimize for speed = 5, opt. level=function -o2).
In the debugger I have verified that the function verify_sync_pulse resurns zero, which is the value for the enumeration element PLM_OK. Both the tooltip and the memory window confirm that (and is what I expected for the data I'm processing). Yet the 'if' does not work: the body does get executed when it should not.
When I disable all the optimization options, the problem dissapears. With no optimization, the generation code does have a B.S1 instruction where you would expect it -- I haven't yet decyphered all the instructions in the listing above but the fact is that the branch is not taken when optimization is enabled.
In short, what can be going on? Is there something else that needs to be done besides just passing the optimization options to the compiler?
My Code Generation Tools is version 6.1.10.
Thanks!