Why does gcc give internal error messages?
If you see diagnostic messages like
../include/wx/ctrlsub.h:156: internal error: Segmentation fault
then try running the same compile command again.
Some internal error messages really are defects in the compiler. If you have a reproducible test case, then mention it on the mailing list . Others may know about your problem already, and be able to help.
Work around: Recompiling at a lower optimisation level will frequently avoid the ICE and allow your compilation to proceed.
Random ICEs due to hardware problems
But if you see random internal error messages that go away when you recompile the same code, then it's almost certainly a hardware problem. This page  explains why that's the case even if gcc is the only program that commonly has this problem.