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.

optimization issue with cgtools 6.1.8

Hi,

I'm building my code CGTOOLS 6.1.8 for DSP 64x+ with following compiler flags (some flags used): -mv6400+, -O2, -g.

 

my source code is something like this:

 

func()

{

bool_t flag1= FALSE, flag2=FALSE, flag3=FALSE

........

........

if (condition1==TRUE)

{

 flag1 = TRUE;

}

...

...

if ((condition2 = FALSE) && (((condition3 = TRUE) ))

{

flag2=TRUE;

}

......

.......

if(flag1==TRUE || flag2==TRUE)

{

 flag3 = TRUE;

...................

}

}

In this, when i have breakpoint at this line in CCS "if(flag1==TRUE || flag2==TRUE)", i see value of flag1 and flag2 to be 0xBB and 0xFF, but it should be "0" or "1" depending upon . these variables are stored in register.

when i use a volatile boolean type variable instead, i see these flags are getting set to either "0" or "1".

Please let me know if this is a known issue with cgtools?

Regards,

Justin

  • Or could it be CCS issue? just that i'm not able to see correct values on CCS window, since optimization is turned on?

  • Debugging optimized code is always subject to these kinds of difficulties.  The variables could be allocated to registers.  These statements are probably changed to predicated instructions which always execute, even if their final results are not written.  And so on.  Moreover, you may see differences in behavior even among compiler releases.  The optimization capabilities of the compiler are always being refined.  

    For more on this topic, please see this Wiki article.

    Thanks and regards,

    -George