AnsweredAssumed Answered

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

Question asked by yadav.anurag on Jan 29, 2016
Latest reply on Jan 30, 2016 by yadav.anurag
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

Outcomes