Wrong overlapping variables in RAM (CW HC08)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Wrong overlapping variables in RAM (CW HC08)

Jump to solution
2,925 Views
elil
Contributor I
Hi,

Recently I found that HC08 C Compiler ovelapped a local automatic variable with a global one, causing the destroy of the global var. In order to prevent it I tried to define the local variable as static and the problem was solved. Another solution was to disable some Optimizer options.
The var. definitions were:
unsigned char *Tx_ptr; // the global var.

typedef union
{
unsigned long l;
unsigned char arr[4];
}adress_format;

adress_format adress; // the local automatic var.
// The adress var. is overlapping *Tx_ptr.

The solution, I found, does not satisfy me, since I haven't found the reason for the problem and the similar problem may be exist in an other place of my code, and I don't want to define all of my local variables as static (it is not economic!).
Any idea is wellcome.

Thank you in advance,
Eli.
Labels (1)
Tags (1)
0 Kudos
Reply
1 Solution
1,094 Views
CrasyCat
Specialist III
Hello

This should be a corner situation of an configuration issue.
Please submit a service request through our on-line support site to get our
support people take a look at that.

CrasyCat

View solution in original post

0 Kudos
Reply
2 Replies
1,095 Views
CrasyCat
Specialist III
Hello

This should be a corner situation of an configuration issue.
Please submit a service request through our on-line support site to get our
support people take a look at that.

CrasyCat
0 Kudos
Reply
1,094 Views
CompilerGuru
NXP Employee
NXP Employee
This is either a compiler bug, then use CrazyCats suggestion and file a service request or this is a simple stack overflow. If so, increase the stack size.

Daniel