It's a good start, but the problems with SSH lately have largely been things like timing attacks that even the smartest compiler won't catch.
In fact a smart optimizing compiler can make that even harder to avoid since it is more difficult to know exactly what machine code it will produce.