If someone has a gun to their own head, they are an immediate threat to themself or others. As such, they can be detained for a psychiatric evaluation. Now, they might face charges for "brandishing a weapon" or somesuch. That is quite different from a law which says "any person who attempts to kill themselves shall, upon conviction, be guilty of _______ and subject to a penalty of ______.
I remain skeptical that such laws exist.