How to get a “bus error”?
I am trying very hard to get a bus error. One way is misaligned access and I have tried the examples given here and here , but no error for me - the programs execute just fine. Is there some situation which is sure to produce a bus error? Bus errors can only be invoked on hardware platforms that: Require aligned access, and Don't compensate for an unaligned access by performing two aligned accesses and combining the results. You probably do not have access to such a system. This should reliably result in a SIGBUS on a POSIX-compliant system. #include <unistd.h> #include <stdio.h> #include <sys