So you have two main solutions for this problem : have all programmers to never ever write faulty code, or design and use programming languages that are safer and less error prone.
One is impossible, while the other is already applied.
In my experience most bugs are due to misunderstanding requirements and simply writing faulty logic. Just a few bugs are related to the language itself.