1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-12 13:01:09 +03:00

Changes to avoid a harmless UB warning from clang.

FossilOrigin-Name: 19f5c1400054df10688ab448e7e23afef97cab4a7c7a3e411f7527509b515dd8
This commit is contained in:
drh
2018-01-27 14:25:27 +00:00
parent c9f3db33d5
commit 1822ebf9b1
3 changed files with 14 additions and 8 deletions

View File

@@ -641,7 +641,13 @@ int sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc){
testcase( i==18*incr );
testcase( i==19*incr );
testcase( i==20*incr );
if( neg ){
if( u>LARGEST_INT64 ){
/* This test and assignment is needed only to suppress UB warnings
** from clang and -fsanitize=undefined. This test and assignment make
** the code a little larger and slower, and no harm comes from omitting
** them, but we must appaise the undefined-behavior pharisees. */
*pNum = neg ? SMALLEST_INT64 : LARGEST_INT64;
}else if( neg ){
*pNum = -(i64)u;
}else{
*pNum = (i64)u;