diff --git a/sqlite-3.22.0-int-float-compare.patch b/sqlite-3.22.0-int-float-compare.patch new file mode 100644 index 0000000..ec7341f --- /dev/null +++ b/sqlite-3.22.0-int-float-compare.patch @@ -0,0 +1,40 @@ +Index: src/vdbemem.c +================================================================== +--- src/vdbemem.c ++++ src/vdbemem.c +@@ -579,10 +579,22 @@ + + pMem->u.r = sqlite3VdbeRealValue(pMem); + MemSetTypeFlag(pMem, MEM_Real); + return SQLITE_OK; + } ++ ++/* Compare a floating point value to an integer. Return true if the two ++** values are the same within the precision of the floating point value. ++** ++** For some versions of GCC on 32-bit machines, if you do the more obvious ++** comparison of "r1==(double)i" you sometimes get an answer of false even ++** though the r1 and (double)i values are bit-for-bit the same. ++*/ ++static int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){ ++ double r2 = (double)i; ++ return memcmp(&r1, &r2, sizeof(r1))==0; ++} + + /* + ** Convert pMem so that it has types MEM_Real or MEM_Int or both. + ** Invalidate any prior representations. + ** +@@ -599,11 +611,11 @@ + if( rc==0 ){ + MemSetTypeFlag(pMem, MEM_Int); + }else{ + i64 i = pMem->u.i; + sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc); +- if( rc==1 && pMem->u.r==(double)i ){ ++ if( rc==1 && sqlite3RealSameAsInt(pMem->u.r, i) ){ + pMem->u.i = i; + MemSetTypeFlag(pMem, MEM_Int); + }else{ + MemSetTypeFlag(pMem, MEM_Real); + } diff --git a/sqlite.spec b/sqlite.spec index d81d1b6..66ccf6a 100644 --- a/sqlite.spec +++ b/sqlite.spec @@ -34,6 +34,8 @@ Patch6: sqlite-3.8.10.1-tcl-regress-tests.patch Patch7: sqlite-3.16-datetest-2.2c.patch # Modify sync2.test to pass with DIRSYNC turned off Patch8: sqlite-3.18.0-sync2-dirsync.patch +# Upstream: https://www.sqlite.org/src/info/1b02731962c21bb0 +Patch9: sqlite-3.22.0-int-float-compare.patch BuildRequires: ncurses-devel readline-devel glibc-devel BuildRequires: autoconf @@ -137,6 +139,7 @@ This package contains the analysis program for %{name}. %patch7 -p1 %endif %patch8 -p1 +%patch9 -p0 autoconf # Rerun with new autoconf to add support for aarm64 @@ -240,6 +243,9 @@ make test %endif %changelog +* Wed Jan 24 2018 Petr Kubat - 3.22.0-2 +- Fixed issue with some e_expr tests failing i686 + * Tue Jan 23 2018 Petr Kubat - 3.22.0-1 - Updated to version 3.22.0 (https://sqlite.org/releaselog/3_22_0.html)