I am not an accountant, so I can't claim to fully understand what qualifies as a gain or loss, but my assumption has always been that the accounting rules are supposed to be sane and reflect the difference between these concepts (a real loss vs. going into debt).