This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

why does this assembly fail?

Hello,

I have this C code

int value_a, value_b ;
value_a = value_b ;

that translates to this assembly:

0x0002B128  E58D600C  STR       R6,[R13,#0x000C]

but the assignment fails - both variables are allocated on the stack. if I allocate the target variable in RAM (say, using "static") it works. alignment issue? something?

Parents
  • value_d and value_f are initialized to 0, the others not!

    The compiler is not required to do everything that's stated in the source code. If variables are never used, the compiler is free to ignore them.

    You may want to try to lower the optimization settings, or declare variables as volatile, if you want the compiler to follow your code more rigorously.

Reply
  • value_d and value_f are initialized to 0, the others not!

    The compiler is not required to do everything that's stated in the source code. If variables are never used, the compiler is free to ignore them.

    You may want to try to lower the optimization settings, or declare variables as volatile, if you want the compiler to follow your code more rigorously.

Children
No data