If the precondition doesn't hold, we will return a pointer to some random memory, so it's best to always crash since this indicates something is seriously wrong.
replaceInvalidRefsWithErrors
makeArrayRef