This is an addendum to the tip titled "Turn on all compiler warnings" that occured on this list some time ago.
Turn off all optimization using -O0 when compiling with gcc or g++. This will help in doing away with any errors that code optimization might introduce.