Is it possible that the compiler is creating this problem, or is it something about the interrupt assembly code, or should I continue to look for an error in my code?
I will bet on the last option

Post your code and let someone offer some help.