Do -fstack-protector and -fstack-protector-all protect heap-based memory allocations too or only stack-based ones ?
What is the difference between the first 2 and -fmudflap ?
Any recommendations as to which is better for debugging ?
(I’m not sure if the gcc man page is clear enough or I simply do not understand it…)
char foobar[10]; // stack-based
char *foobar = malloc(10); // heap-based
Mudflap is for pointer checks. See this pdf.
You will need to install the relevant libs to be able to use these gcc features.
I like valgrind better for detecting such errors because there is no need to recompile/relink and is easier to use, but these can be valuable too.