A Comment on the Military Industrial Complex

Remy escaped the enterprise world and now makes LEDs blink pretty. Editor-in-Chief for TDWTF.

Simon T tugged at his collar when the video played. It wasn’t much, just a video of their software being tested. It wasn’t the first time they’d tested Simon’s most recent patch, but it was going to be the last time. There were a lot of eyes in the conference room, and they were all turned on him.

Simon worked for the kind of company which made missiles. The test in the video was one of the highly expensive tests of a real missile under real-world conditions. Several of these had already been done with this software package, so Simon hadn’t expected any problems to crop up. In this case, though, the missile left its launcher and sailed in a perfect parabolic arc into the ground 5 meters away from the launch site.

Missiles diving headfirst into the ground mere meters from their launch site was officially considered a bad thing. There were all sorts of checkpoints and automated tests and simulations that were supposed to keep this thing from happening. It didn’t take long to find the problem.

This code happens to be Turbo Pascal 4, a version of the language released in 1987. Simon’s job had been to create this Turbo Pascal code by porting the logic from Fortran 68, running on a mainframe. Due to hardware constraints, the Fortran version took 8 hours to simulate and calculate a missile’s trajectory. Simon’s Turbo Pascal version could do the same job in near real time.

There’s just one problem. Curly brackets in Turbo Pascal can be used to mean radically different things. On a line by themselves, they can substitute for begin or end statements, but they can also serve as comment indicators.

And you can see where this is going. Simon left off his closing } on the {we're adjusting… line. You might expect an error like that to be caught by the compiler, and it might have… had he not also had the { add gravity } comment, which handily provided a closing curly brace, essentially commenting out the entire body of the if statement.

In their testing, they’d somehow never hit this condition. Even in the real-world tests, the wind had previously been blowing from the west, which meant the missile had a positive value for roll. Only on a day with an easterly wind did they catch this bug.