Shaming and compassion can, and often do happen in the same moment.
Compassion is something that's given. Shame is something felt by the recipient.
When I asked my most recent ex if she was okay because I thought she was drinking too much, that was entirely compassionate. I didn't insult her. I never even pointed out demonstrable issues that her drinking might have already created in her life. I just wanted her to be as happy as she could be, and she decided that I was shaming her.
In reverse, when I was drinking myself to death, my loved ones told me that they thought that I was being unhealthy, and I felt shamed in response. They were right.
It's not lost on me that some people shame others out of malic -- I've seen Game of Thrones. Still, we have to understand that's there a massive spectrum between needless shaming and shame that's taken in response to caring people.