Sten Siren

Entry code

Discussion created by Sten Siren on May 17, 2006
Latest reply on May 19, 2006 by CompilerGuru
CW for HC12 v. 4.5 build 6039
 
I have the following function:
void memfill(BYTE c) {    asm {  ldaa c
  ......    }    return;}

 This was by CW for HC12 v. 3.1 compiled to
PSHBLDAA 0,SP...PULARTC

 which did work, but v. 4.5 compiles to
LEAS -1,SPLDAA 0,SP...LEAS 1,SPRTC
 
which does not work because the function parameter 'c' does not get saved to the stack and thus the LDAA 0,SP will load something undefined.
 
I have in the same file an other routine which also returns the c-value, and that routine works on both versions.
 
This is clearly some kind of optimizing issue, but what optimization option could I use to get the PSHB back?
 

Outcomes