1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

Completely unwind the enhanced precision sum() from [a915f15a916af698] so

as not to offend UBSAN and OSS-Fuzz.

FossilOrigin-Name: 85be05b66ef975f02a3e7b2984bcab97d9280c7f3b6ee1e16718de549f240d46
This commit is contained in:
drh
2023-06-30 14:01:09 +00:00
parent dd8b12a6c5
commit 48114d08cf
6 changed files with 63 additions and 121 deletions

View File

@ -862,30 +862,13 @@ do_test func-18.11 {
}
} integer
ifcapable floatingpoint {
do_test func-18.12 {
catchsql {
INSERT INTO t6 VALUES(1<<62);
SELECT sum(x) - ((1<<62)*2.0+1) from t6;
}
do_catchsql_test func-18.12 {
INSERT INTO t6 VALUES(1<<62);
SELECT sum(x) - ((1<<62)*2.0+1) from t6;
} {1 {integer overflow}}
do_test func-18.13 {
execsql {
SELECT total(x) - ((1<<62)*2.0+1) FROM t6
}
} 0.0
}
ifcapable !floatingpoint {
do_test func-18.12 {
catchsql {
INSERT INTO t6 VALUES(1<<62);
SELECT sum(x) - ((1<<62)*2+1) from t6;
}
} {1 {integer overflow}}
do_test func-18.13 {
execsql {
SELECT total(x) - ((1<<62)*2+1) FROM t6
}
} 0.0
do_catchsql_test func-18.13 {
SELECT total(x) - ((1<<62)*2.0+1) FROM t6
} {0 0.0}
}
if {[working_64bit_int]} {
do_test func-18.14 {
@ -910,7 +893,7 @@ if {[working_64bit_int]} {
(SELECT 9223372036854775807 AS x UNION ALL
SELECT -10 AS x);
}
} {1 {integer overflow}}
} {0 9223372036854775797}
do_test func-18.17 {
catchsql {
SELECT sum(x) FROM
@ -1547,11 +1530,11 @@ do_execsql_test func-36.110 {
# Enhanced precision of SUM().
#
reset_db
do_execsql_test func-37.100 {
do_catchsql_test func-37.100 {
WITH c(x) AS (VALUES(9223372036854775807),(9223372036854775807),
(123),(-9223372036854775807),(-9223372036854775807))
SELECT sum(x) FROM c;
} {123}
} {1 {integer overflow}}
do_catchsql_test func-37.110 {
WITH c(x) AS (VALUES(9223372036854775807),(1))
SELECT sum(x) FROM c;