By far the most common cause of a segmentation fault is a programming error; that is, a bug in the program. The error "comes from" hardware, because it is hardware that detected the error.
Go back to what you were doing before. Don't try to replace the compiler. Compile your program with the -g switch, which tells the compiler and linker that you'll be using a debugger. Then use gdb to find out where in your program the blowup happens.
Get documentation for gdb here:
You have a long road ahead of you, but an interesting one.
Hope this helps.