aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authordrh <>2023-07-05 19:56:14 +0000
committerdrh <>2023-07-05 19:56:14 +0000
commit728650ecb33585d67eea9e5c1ae82df81a46c9cb (patch)
tree3fbac79bbeb75056e7278deaa288119d6c8798f4 /src/util.c
parente68899f1e4a4feac59b3ec61c6bfa1b78f221a6c (diff)
downloadsqlite-728650ecb33585d67eea9e5c1ae82df81a46c9cb.tar.gz
sqlite-728650ecb33585d67eea9e5c1ae82df81a46c9cb.zip
Improved comments on the work-around to the GCC x86 floating point wonkiness.
FossilOrigin-Name: 7b4c16731e7bf6f03f5adf4fcb2008c0b19be473fb1b90b405c217c08916586a
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index 52dc09a7d..6b757e4fb 100644
--- a/src/util.c
+++ b/src/util.c
@@ -387,9 +387,20 @@ u8 sqlite3StrIHash(const char *z){
}
/*
-** Work around an apparent bug in GCC.
+** Work around an issue in GCC where it generates code that stores
+** intermediate results to a higher precision than binary64. This
+** messes up the Dekker algorithm. See the discussion at
** https://sqlite.org/forum/info/ee7278611394034c
+**
+** By adding the -ffloat-store option, it forces GCC to truncate
+** intermediate results to the correct precision. The GCC devs
+** recommended -fexcess-precision=standard or -std=c99. Those options
+** work too, from the command-line, but I could not get them to work
+** as a #pragma. We want the "sqlite3.c" to "just work" without
+** requiring any special compiler-options, so we continue to use
+** the -ffloat-store method of working around the issue.
*/
+
#ifdef i386
#pragma GCC push_options
#pragma GCC optimize("float-store")
@@ -423,7 +434,7 @@ static void dekkerMul2(double *x, double y, double yy){
x[1] += cc;
}
-/* End of the GCC bug work-around */
+/* End of the GCC x86 floating-point work-around */
#ifdef i386
#pragma GCC pop_options
#endif