Is it somehow possible to catch data-alignment faults even on i386? Maybe by setting a i386 specific machine register or something like that.
On Solaris-Sparc I am r
I have found a very simple solution on SOF! See: Mis-aligned pointers on x86.
int main(int argc, char **argv)
{
# if defined i386
/* EDIT: enable AC check */
asm("pushf; "
"orl $(1<<18), (%esp); "
"popf;");
# endif
char d[] = "12345678"; /* yep! - causes SIGBUS even on Linux-i386 */
return 0;
}
But I must confess that I do not understand why the assignment
char d[] = "12345678";
is assumed to be mis-aligned?
EDIT:
on the SPARC machine there is no SIGBUS on the line of assignment to char d[].