Declarations would enter an infinite loop when trying to loop over basic blocks. That was probably an undefined operation, but still somehow didn't crash the compiler. Make sure that scanning declarations works as expected.