Altera_Forum
Honored Contributor
8 years agoNios - II memory alignment issue while accessing integer from non word align location
- Using Nios-II with eclipse. While accessing integer(32 bit) form non word align location getting incorrect value as described in below example.
- Tested with eclipse version 13 and 16, both are giving same result. - Test case : -------------------------------------------------------------------------------- char c[10] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88}; printf("int = 0x%08x", *(int*)(&c[2])); -------------------------------------------------------------------------------- above code should print "int = 0x66554433" but getting "int = 0x44332211"