On Wednesday 27 May 2009 16:20:16 Nathan Wharton wrote:
On Tue, May 26, 2009 at 5:13 PM, Sven Eckelmann sven.eckelmann@gmx.de
wrote:
========================================= #include <stdio.h> #include <stdlib.h>
#define x_moved(pos) ((int*)&x[pos])[0] static const int value1 = 0x01234567; static const int value2 = 0x89abcdef;
int main() { volatile char *x = (char*)malloc(sizeof(int) * 2); x_moved(0) = value1; x_moved(2) = value2;
if (x_moved(2) != value2) { printf("ERROR Value: "); } else { printf("Value: "); } printf("%x %x\n", x_moved(0) , x_moved(2)); free(x); return 0;
}
This results in: ERROR Value: 89abcdef cdef89ab
Thanks. This is completely unexpecting for a kernel with alignment trap. The expected result is "Value: 12389ab 89abcdef". Can you check the value of /proc/cpu/alignment ? I will look further at it this evening.
Regards, Sven