Hello
I have a problem of alignment. This program can't get the result I expect. The instruction is used by LDW instead of LDNW. Could you give me an advice?
Best regards
- DSP: C66xx
- CCS: v5.1.1
- CGT: v7.4.4
#include <stdio.h>
#pragma pack(2)
struct t_test2 {
short vs;
struct t_test1 *pointer; // condition-1: This pointer doesn't align to 4-byte boundary.
} str2;
struct t_test1 {
char c1;
char c2;
} str1;
void main(void) {
char *p1;
char *p2;
str2.pointer = &str1;
p1 = &str2.pointer->c1; // condition-2: This pointer indicated by "->" is the top of the structure.
printf ("p1=0x%08x\n", p1); // p1=0xece60000: bad address by LDW
p2 = &str2.pointer->c2;
printf ("p2=0x%08x\n", p2); // p2=0x0000ece7: good address by LDNW
}