I wrote about this problem in other posts. Although this is not the case.
GCC compiler version: 4.8.3 (for ARM)
Code excerpt:
uint8_t data[4] __attribute__ ((aligned (8))) = {1,2,3,4};
int main()
{
uint32_t p = 0;
p = (uint32_t)&data[0];
p = (uint32_t)&data[1];
p = (uint32_t)&data[2];
p = (uint32_t)&data[3];
}
Please note that data is outside any function, so it is NOT allocated in the stack.
The result I am seeing (when debugging) for p
is: 536870912, 536870913, 536870914, 536870915;
I am expecting something like this: 536870912, 536870920, 536870928, 536870936
Any help would be much appreciated.