Bugs can be expensive, and bugs can kill. Carnegie Mellon University Professor Phil Koopman specialises in embedded software quality including safety-critical areas such as self-driving cars and other automotive software. In a recent post about potentially deadly automotive software defects he lists more than 50 reports of disturbing defects such as unintended acceleration, cruise control which will not disengage, and power steering preventing the driver from controlling the vehicle.
Koopman makes the point that improving software quality is largely a matter of observing best practice.
These include reducing code complexity, using static analysis tools and compiling with zero warnings, rigorous checking of real-time code scheduling, satisfactory software testing, and use of basic tools including configuration management, version control and bug tracking.