Thanks for the report. Now fixed [on trunk][1].
Wang Ke probably already knows this, but for the benefit of other readers,
the NEVER() macro in SQLite basically means "we don't have a test case
for this condition but we should probably check it anyhow." On debug
builds, the NEVER() raises an assertion fault if it is ever true, but for
release builds it is a no-op. In that way, NEVER() macros alert us to
new untested branches. Release builds are unaffected.
Hence, this is not a problem in release builds.
The simplest fix here would be to simply delete the NEVER(). But I took
the opportunity to also clean up the isSimpleCount() function a little.
Test cases were added to [TH3][2] and [dbsqlfuzz][3].
[1]: src:/info/2927185be81a5aa0
[2]: https://sqlite.org/th3.html
[3]: https://sqlite.org/testing.html#the_dbsqlfuzz_fuzzer