So I've tested emacs -Q a bit (compiled with --enable-checking=all) with the attached patch. I had no error so far.