cancel
Showing results for 
Search instead for 
Did you mean: 

Push mechanism on stack fails during the function call when we select “Minimize code size (+compact)� option for optimization from the drop-down list in STVD with Cosmic compiler (4.4.2) for STM8

angyadav31
Associate
Posted on January 29, 2016 at 14:13

Hello Everyone,

I am facing some issue with cosmic compiler version 4.4.2 for STM8. I have seen following run time problems.

Push mechanism on stack fails during the function call when we select “Minimize code size (+compact)�? option for optimization from the drop-down list in STVD.

  • We have seen a function having some argument and/or return value doesn’t return to the address from where It had called, instead it reaches any address of code area. However same function was working well when its been called two or so line before. And without optimization it works fine.
  • After debugging we observed that there is some issue with stack push mechanism because when function called (during fail case), the data on stack memory for “function argument�? and “function return address�? was not in same sequence as when function succeed.  However all the time when succeed it find in same sequence.
  • Also, the values of all the function argument was different what we have passed. (This is because argument align on the right address even in problem case and the value pushed on stack differently). 
  • If we manually write the values on stack memory in the same sequence as when function succeed during debugging, function got succeed.

''continue;''

statement not correctly working in some casesas per standard even all optimization off

.

  • Processor executes the last line in loop even continue statement execute before, in same iteration.

Please help me out.

Thanks
2 REPLIES 2
luca239955_stm1_st
Senior II
Posted on January 30, 2016 at 09:16

Hello,

this is a known problem that only affects v4.4.2 when using the +compact option.

If you download the latest version the problem will go away.

Sorry for the inconvenience.

Regards,

Luca (Cosmic)

angyadav31
Associate
Posted on January 30, 2016 at 12:27

Hi Luca,

Thanks for your quick response. I will update you after trying next version (4.4.3).

Thanks,

Anurag