Suspected implicit conversion errors
At line 524 and 526 of sqlite/src/func.c, clang10 complains that "error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775806 to 9223372036854775808 if( n==0 && r>=0 && r<LARGEST_INT64-1 ){ " “error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775806 to 9223372036854775808 } else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){”
The source code is
if( n==0 && r>=0 && r<LARGEST_INT64-1 ){
r = (double)((sqlite_int64)(r+0.5));
}else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 )
r = -(double)((sqlite_int64)((-r)+0.5));
if r is 9223372036854775806.9, there might be a risk of overflow.
In fact, SQLite has already changed its code, please reference https://github.com/mackyle/sqlite/commit/26b1526dbf1ce82c90d0deb76cf322eb9b15b130.
Similarly, at line 264 of lua/ltypes.c, clang10 also reports a compilation error: "error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775807 to 9223372036854775808 [-Werror,-Wimplicit-int-float-conversion] dbl:if (darg < LLONG_MIN || darg > LLONG_MAX)". The source code is
dbl:if (darg < LLONG_MIN || darg > LLONG_MAX)
265 luaL_error(lua, "conversion to: int failed from: %f", darg);
266 *val= (long long) darg;
267 return;
If darg is 9223372036854775807.5(could this happen?), there might be a risk of overflow.