I am using S12ZVMC128 MCU and Using Codewarrior version 10.7 as IDE.
There are three variables and all are global static variables, If we assign them with Zero at the beggining, They behave randomly and we assign them with the values other than Zero or don't assign them then their behavior will be as expected.
For ex, If
static Unsigned char a = 0; //
static Unsigned int b = 0; // Behavior will be random.
static Unsigned char c = 0; //
static Unsigned char a = 1; //
static Unsigned int b = 1 ; // Behavior will be fine.
static Unsigned char c = 1; //
static Unsigned char a; //
static Unsigned int b; // Behavior will be fine.
static Unsigned char c; //
In Case 1, Case 2 and Case 3, Variables are stored at different locations.
In Case 2, we are guessing that it will be store in initialized data area.
in Case 1 and 3, it will go into .bss, we guess that is happening but still it getting stored in a different in .bss area itself.
Note: If it helps you to help in solving this, These variables are used in interrupt ISR routine.