I have the following code:
#include <stdio.h>
int main(void)
{
int x __attribute__ ((aligned (16))) = 0;
printf("%lX\n", &x);
return 0;
}
Compiling and running this code using mingw32-c++.exe (GCC) 3.4.5 (mingw-vista special r3)
prints 0x22FF24
which is 0b1000101111111100100100
.
Compiling and running this code using g++ (Debian 4.3.2-1.1) 4.3.2 prints 0x7FFFF470EE90
which is 0b11111111111111111110100011100001110111010010000
.
Due to the alignment I expect the last 7 bits of the variable's address to be zero. Do I make an error in reasoning here? What's going on?
Thanks in advance,
Sebastian