If one hits himself out of compulsion, is it sinful? Or when someone punishes himself for bad thoughts?
Accidents are not sinful.
Being addicted is not sinful. (Staying addicted may be)
Having an autistic stim is not sinful.
Having a Tourette’s tic is not sinful.
If you situation falls outside of the above (which can only be determined with professional help) then seek professional help.
I mean hitting himself without any illness
I believe physically assulting anyone including yourself is grave matter.
You’ll have to discern your consent and knowledge yourself.
I hear " cutting " is a problem with young people -
Self-flagellation as a form of mortification and penance is a part of the Christian tradition but it should be used in moderation and under the guidance of a mature spiritual director. See the Catholic Encyclopedia article on Flagellation.
Yep it sure is a problem and I have the scars to prove it I use to do things like that all the time but not because I was depressed but out of pure anger I would bite my hands till they poured with blood I generally don’t feel pain when I’m angry but after talking with a nice preist a few times a week he taught me how to remain calm he was the most holy preist with the gentlest voice it was like listening to gods voice or looking in to the face of god I would burst out crying when he spoke not because I was sad because I could feel the Holy Spirit radiating from him