Imagine being a virus writer crafting a virus so complicated that it would only work in a future not written different kind of OS or virtual machine, and work in differing operating systems, and identify and poke for weaknesses by itself.
Perhaps it would just be a Science Fiction plot device!
Well, something more nefarious is already possible with a bit of money. Someone could hide a few armed drones set to wake up 100 years from now, setted up to shoot everyone they find. The perfect crime in the sense that police can't capture him if he is already dead.
Luckily this seems not easy. Mechanical parts do not like being unmaintained for decades, while being stored in a damp/sandy/cold/hot environment. Batteries, solar cells and other means of stored energy are not to fond of that either.
A virus on the other hand that inserts itself for example into source code could very well live a long time.
Perhaps it would just be a Science Fiction plot device!