Program received signal SIGSEGV, Segmentation fault

If you are on Linux, try running valgrind. You just compile with -g (with gcc), and then run your program with valgrind in front:

$ valgrind myprogram

Unlike the GCC solutions, which tell you when the segfault occurs, valgrind usually tells you exactly when the first memory corruption occurs, so you can catch the problem much closer to its source.

PS. It rhymes with “flint”, not “find”.

Leave a Comment