Altera_Forum
Honored Contributor
14 years agoNIOS gcc alignment control
Hello,
The bellow given code on NIOS results to var=0x0201, but it shoud result in var=0x0302. I have tried various combinations with __attribute__ ((align(1)), but with no success. Can I somehow set NIOS gcc compiler to produce byte aligned data access? unsigned[/B][/B] char[/B][/B] mmm[3]={0x01,0x02,0x03}; unsigned[/B][/B] short[/B][/B] var; int[/B][/B] main() { var=*((unsigned[/B][/B] short[/B][/B]*)(mmm+1)); }