The crash that caused the original revert has been fixed in a3c964a2. I also added a reduced version of the crash reproducer. This reverts the revert commit 2107af9c.