SQLite Forum

Checkin [bfd8d910] fails on i686
Login

Checkin [bfd8d910] fails on i686

(1) By Reinhard Max (reimax) on 2023-10-18 17:15:30 [source]

The tests introduced in bfd8d910 fail on i686 when compiling SQLite with --enable-rtree (apparently independent of other compile time options):

--- snip ---
rtree1-21.1... Ok
rtree1-22.0...
! rtree1-22.0 expected: [123]
! rtree1-22.0 got:      []
rtree1-22.1...
! rtree1-22.1 expected: [123 1]
! rtree1-22.1 got:      [123 0]
rtree1-23.0... Ok
--- snap ---

$ gcc --version
gcc (SUSE Linux) 13.2.1 20230912 [revision b96e66fd4ef3e36983969fb8cdd1956f551a074b]

(2) By Reinhard Max (reimax) on 2023-10-19 13:16:35 in reply to 1 [link] [source]

BTW, the test succeeds on 32-bit ARMv7, so it is not a general 32-bit issue, but apparently specific to the 32-bit x86 platform.

(3) By Richard Hipp (drh) on 2023-10-19 13:52:24 in reply to 1 [link] [source]

Please run the following script in the SQLite CLI on your i686 machine and post the output:

.mode quote
CREATE VIRTUAL TABLE t1 USING rtree ( id, x0, x1 );  
INSERT INTO t1 VALUES (123, 9223372036854775799, 9223372036854775800);
SELECT id, ieee754(x0), ieee754(x1) FROM t1;
SELECT id, ieee754(9223372036854775799), ieee754(9223372036854775800) FROM t1;
SELECT id, decimal(x0), decimal(x1) FROM t1;
SELECT id, decimal(9223372036854775799), decimal(9223372036854775800) FROM t1;
SELECT id, CAST(x0 AS integer), CAST(x1 AS integer) FROM t1;
DELETE FROM t1;
INSERT INTO t1 VALUES(456, ieee754(4503599627370496,11), ieee754(4503599627370496,11));
SELECT id, ieee754(x0), ieee754(x1) FROM t1;
SELECT id, decimal(x0), decimal(x1) FROM t1;
SELECT id, CAST(x0 AS integer), CAST(x1 AS integer) FROM t1;

I do not have i686 hardware on which to test. Perhaps the output will provide some clue about what is going wrong on that (now obscure) platform.

(4.1) By Sam James (thesamesam) on 2023-10-23 21:49:50 edited from 4.0 in reply to 3 [link] [source]

Are you sure you don't have i686 hardware? Usually people making these reports are doing so from x86_64 hardware using a linux32'd chroot of a x86/i686 userland.

I don't think there's any (if there are, they're very rare indeed) 64-bit only x86_64 CPUs in production yet.

Some CPUs have different semantics for FP but often a 32-bit userland is sufficient or playing with the -mfpmath and maybe -march compiler options at most.

(5) By Reinhard Max (reimax) on 2023-10-24 14:02:00 in reply to 3 [link] [source]

As Sam suggests, this is not native i686 hardware, but a chrooted 32 bit userland on a 64 bit kernel:

# linux32 chroot /some/path

# uname -a
Linux nitsch.suse.de 6.4.6-1-default #1 SMP PREEMPT_DYNAMIC Tue Jul 25 04:42:30 UTC 2023 (55520bc) i686 i686 i386 GNU/Linux

# tclsh <<<'parray tcl_platform'
tcl_platform(byteOrder)     = littleEndian
tcl_platform(engine)        = Tcl
tcl_platform(machine)       = i686
tcl_platform(os)            = Linux
tcl_platform(osVersion)     = 6.4.6-1-default
tcl_platform(pathSeparator) = :
tcl_platform(platform)      = unix
tcl_platform(pointerSize)   = 4
tcl_platform(threaded)      = 1
tcl_platform(user)          = root
tcl_platform(wordSize)      = 4

# sqlite3 -quote
SQLite version 3.43.2 2023-10-10 12:14:04
Enter ".help" for usage hints.
sqlite> CREATE VIRTUAL TABLE t1 USING rtree ( id, x0, x1 );  
sqlite> INSERT INTO t1 VALUES (123, 9223372036854775799, 9223372036854775800);
sqlite> SELECT id, ieee754(x0), ieee754(x1) FROM t1;
123,'ieee754(9007198180999168,10)','ieee754(4503599627370496,11)'
sqlite> SELECT id, ieee754(9223372036854775799), ieee754(9223372036854775800) FROM t1;
123,'ieee754(4503599627370496,11)','ieee754(4503599627370496,11)'
sqlite> SELECT id, decimal(x0), decimal(x1) FROM t1;
123,'9223370937343148032','9223372036854775808'
sqlite> SELECT id, decimal(9223372036854775799), decimal(9223372036854775800) FROM t1;
123,'9223372036854775799','9223372036854775800'
sqlite> SELECT id, CAST(x0 AS integer), CAST(x1 AS integer) FROM t1;
123,9223370937343148032,9223372036854775807
sqlite> DELETE FROM t1;
sqlite> INSERT INTO t1 VALUES(456, ieee754(4503599627370496,11), ieee754(4503599627370496,11));
sqlite> SELECT id, ieee754(x0), ieee754(x1) FROM t1;
456,'ieee754(4503599627370496,11)','ieee754(4503599627370496,11)'
sqlite> SELECT id, decimal(x0), decimal(x1) FROM t1;
456,'9223372036854775808','9223372036854775808'
sqlite> SELECT id, CAST(x0 AS integer), CAST(x1 AS integer) FROM t1;
456,9223372036854775807,9223372036854775807

(6) By Reinhard Max (reimax) on 2023-11-10 09:01:59 in reply to 5 [link] [source]

Did this help in any way to narrow down the problem?