Pular para o conteúdo principal
Renesas Brasil - Knowledgebase

W0523082 Message (CC-RL)

Last Updated:04/17/2017


I am using the CC-RL compiler for RL78 devices. Why does the following message appear when I set the address of a variable in a pointer: “W0523082: Pointer to the object of even alignment holds the odd address"?
unsigned char c;
unsigned short *p;
p = (unsigned short *)&c


The processors of RL78 family devices do not support incorrectly aligned access (2-byte access to odd addresses).
That’s why you’re getting that message.
In the example you’ve given, the alignment condition for access to variable c is a pointer to 1 byte, but pointer variable p is a pointer with an alignment condition of 2 bytes. 
In case of access to variables of different types, if all variables to be accessed are members of a union, access to the member names will always match the alignment condition for the types to be accessed.
union {
 unsigned char c;
 unsigned short s;
unsigned short *p;
p =&u.s;

Suitable Products
e² studio
CS+ (formerly CubeSuite+)
C Compiler Package for RL78 Family
  • Este artigo foi útil?