Hi. I am trying to generate a bus error using unaligned memory but it's not working. I tried it myself first but couldn't get it to work, so I used the code from the wikipedia entry:
It seems to run fine. The version of gcc is 4.1.2. It is supposed to generate a bus error so why isn't it?Code:#include <stdlib.h> int main (void) { int x, *iptr; char *cptr; cptr = (char*)malloc(33); if (!cptr) return 1; cptr++; x = *cptr; iptr = (int *) cptr; x = *iptr; return 0; }