Terminator I,II, etc.
numerous bad Jean Claude van Damme movies
There's also well-written fiction on this subject--Stanislaw Lem wrote much on this. And Asimov's Laws of Robotics are designed to fight this.
Now you know why these stories get written--the military really is dumb enough to make flying killer robots just to save money (yes, lots of money) in the goal of maximizing lethality.
Let's just hope Microsoft isn't writing the software.
Any given program will expand to fill available memory.