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

initialization of global variable is missing by the compiler

  1. I have that simple code:

 int a = 6;

main {

      DbgPrint("a=%d', a);

}

when I run t the variable a  should  be 6 but not!!

  1. I have an linux arm a53 simulation environment and I compile c code for aarch64 with arm c compiler - (baremetal version without any additional  libc or CRT included).
  2. I observed that the global variable don't have the values I set for them into the code but random value.  I disable the code and indeed no init of that variable.

Who should  init that variable , no the compiler ? I don't expect CRT to set it . I expect only .bbs section to be set to zero by CRT at runtime stage.

Parents Reply Children
No data