Poor people do cling to guns in religion. It's not a gaffe to say something true.
Stating people "cling" to guns or religion are such ambiguous claims as to be neither provable, or disprovable. One could say that there are a large number of poor people whom "cling" to the Democratic party. Or, you could say that there are a large number of poor people whom prefer the Democratic party. Of course, you could say that there are a large number of poor people whom prefer to go to church on Sunday. Neither preferring to own a gun, or believing in the resurrection of Jesus Christ is inherently sinister, which is what your formulation suggests.
And, yes, it is an major error for a politician wooing the votes of religious people to gratuitously insult their faith.