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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user