A person can be gloomy, meaning down in the dumps, but not dismal, unless he's a dismal failure, and he can't be a gloomy failure in quite the same way. A gloomy swamp is a dismal one, though, and a dismal swamp is gloomy. The two words collocate differently sometimes, and they sound somewhat different notes in the reader's mind. There is no such thing as a synonym.