Forum Discussion
Nios - II memory alignment issue while accessing integer from non word align location
- 7 years ago
Hi Vasu,
Try by going to the project folders > right-click > properties> Nios II Application properties >
Debug Level = 2
Optimization Level =2
This gives the required output
Best Regards,
Anand Raj Shankar
(This message was posted on behalf of Intel Corporation)
Hi Anand,
We have tried using Quartus 18 and at first sight we got expected result. But when we checked for memory address of C[2] it was already word aligned, so it was expected behavior. Can you please check below program with your system?
char c[10] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88};
printf("int starting c[0] = 0x%08x and address = 0x%08x\n", *(int*)(&c[0]), (int)&c[0]);
printf("int starting c[2] = 0x%08x and address = 0x%08x\n", *(int*)(&c[2]), (int)&c[2]);
// We are expecting following output:
// int starting c[0] = 0x44332211 and address = .....
// int starting c[2] = 0x66554433 and address = .....
Thanks,
Vasu.