It's highly unlikely a dog would die from eating gunpowder alone. Gunpowder isn't inherently toxic, though it may cause mild stomach upset. The real danger would be detonation, which is extremely unlikely inside a dog.
However, some gunpowder contains lead or other contaminants. If your dog eats gunpowder, call your vet immediately, don't induce vomiting, and monitor for illness.