Question: are gnats attracted to bread?
Answer: Fruit flies are attracted to rotting produce, which will ferment and produce alcohol which they will feed on. They will be attracted to the yeast in bread, so I would throw out the bread to be on the safe side.