One of my friends is having a big problem trying to debug a code that started showing \"alignment trap\" errors. The problem happens when a global structure is accessed by a
It is operating system and processor specific (and ABI specific too).
You have some memory corruption, or memory leak or buffer overflow, etc..., or you are dereferencing some bad pointer (either uninitialized, or computed wrongly) - e.g. a pointer to double which is not a multiple of 8 (or, on some architectures, a pointer to int which is not multiple of 4), or perhaps you are jumping to some invalid address (e.g. to a bad function pointer).
On Linux, I would suggest to compile with gcc -Wall -g and to use the debugger (gdb) and valgrind. You might be interested in using -fsanitize=address or -fsanitize=undefined compilation flags (with GCC 4.9). They both instrument (so modify) the generated code.
Read about undefined behavior. You surely got some.