Move a function into assert() so that GCC won't complain that the
function is not used in release build.