This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Issue with logical comparison for double dimm array with TMS320vc5470 and TMS470 4.9.1 compiler

We are working on the following environment:

Ti processor: TMS320vc5470
Cross-Compiler: tms470 4.9.1 for ARM 7 TDMI
CCS Version: 5.5.0.00077

I am observing an interesting behavior with the below code snippet in the above environment.

Code Snippet:
============================
/*Increment the particular fault counter, if the fault occurs > 4 times, stop logging the error*/
NumEvt[app][err] = NumEvt[app][err] + 1; (On power on the array is initialized with ZERO’s)

if(MAX_FAULTS_OCCUR < NumEvt[app][err ) ==========Issue found at this line.
{
NumEvt[app][err] = MAX_FAULTS_OCCUR+1;
}

/*Log the error*/
if((NumEvt[app][err] <= MAX_FAULTS_OCCUR)
&&(FLAddrCnt <= MAX_ERROR_LOG_SIZE))
{

---
----
----
============================

In the above if condition, when the logical operator (> or <) is used for a Two dimensional array value comparison, I see that the base address of the array is not correctly evaluated(Bytes are swapped!!) in the comparison case. Attached is the dis-assembly of the above code.

Base Address of NumEvt is 0x1045700C.

Register observation for NumEvt[app][err] = NumEvt[app][err] + 1; statement. (No issues found in increment case)

R12 = 0X1D (Which is app index in NumEvt array)
R0 = 0X1045700C (Which is base address of NumEvt array)
R12 = 0X10458D0C
R0 = 0XC0 (Which is err index in NumEvt array)
R12 = 0
R12 = 1
R0 =0X1D
R1 = 0X1045700C
R0 = 0X10458D0C
R1 = 0XC0

Register observation for if(MAX_FAULTS_OCCUR < NumEvt[app][err ) condition (Issue found here)

R12 = 0X1D
R0 = 0X700C1045 (something wrong here , It looks like the base address of the two dimensional array is swapped, It is supposed to be 0X1045700C)
R12 = 0X700C2D45
R0 = 0XC0
R12 = 0 (undefined value)

Due to the wrong base address evaluation the comparison result is undefined.

Please let me know what is the issue here. Let me know if you need more inputs from me on this issue.