The code for monitorenter does not always check that the argument is not null. This result in a NullPointerException inside uninterruptible code.
I have seen that on PPC OSX using the base compiler. I do not know whether this happens on other architectures/compilers.
Opt compiler generates correct code (does null check before entering uninterruptible locking region).