SQLite Forum

LTO warnings with 3.45.1
Login

LTO warnings with 3.45.1

(1) By Sam James (thesamesam) on 2024-02-29 03:23:41 [source]

Hi all,

We're currently looking at building more of our distribution (Gentoo) with LTO. When doing that, we're using -flto -Werror=lto-type-mismatch -Werror=strict-aliasing -Werror=odr to help find likely runtime issues.

When building SQLite, these two popped up:

/var/tmp/portage/dev-db/sqlite-3.45.1-r1/work/sqlite-src-3450100-abi_x86_32.x86/test/fuzzcheck.c:164:12: error: type of 'sqlite3_vt02_init' does not match original declaration [-Werror=lto-type-mismatch]
  164 | extern int sqlite3_vt02_init(sqlite3*,char***,void*);
      |            ^
/var/tmp/portage/dev-db/sqlite-3.45.1-r1/work/sqlite-src-3450100-abi_x86_32.x86/test/vt02.c:1015:5: note: 'sqlite3_vt02_init' was previously declared here
 1015 | int sqlite3_vt02_init(
      |     ^
/var/tmp/portage/dev-db/sqlite-3.45.1-r1/work/sqlite-src-3450100-abi_x86_32.x86/test/vt02.c:1015:5: note: code may be misoptimized unless '-fno-strict-aliasing' is used

and

/var/tmp/portage/dev-db/sqlite-3.45.1-r1/work/sqlite-src-3450100-abi_x86_32.x86/test/fuzzcheck.c:165:12: error: type of 'sqlite3_randomjson_init' does not match original declaration [-Werror=lto-type-mismatch]
  165 | extern int sqlite3_randomjson_init(sqlite3*,char***,void*);
      |            ^
/var/tmp/portage/dev-db/sqlite-3.45.1-r1/work/sqlite-src-3450100-abi_x86_32.x86/ext/misc/randomjson.c:217:5: note: 'sqlite3_randomjson_init' was previously declared here
  217 | int sqlite3_randomjson_init(
      |     ^
/var/tmp/portage/dev-db/sqlite-3.45.1-r1/work/sqlite-src-3450100-abi_x86_32.x86/ext/misc/randomjson.c:217:5: note: code may be misoptimized unless '-fno-strict-aliasing' is used
lto1: some warnings being treated as errors
lto-wrapper: fatal error: //usr/bin/x86_64-pc-linux-gnu-gcc returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/14/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

It seems to only affect the tests.

Originally reported downstream in Gentoo at https://bugs.gentoo.org/924300.

(2) By Stephan Beal (stephan) on 2024-02-29 10:56:35 in reply to 1 [link] [source]

When building SQLite, these two popped up:

That's now fixed in the trunk.

It seems to only affect the tests.

Correct.

Thank you for the report!

(3) By Sam James (thesamesam) on 2024-03-01 04:16:34 in reply to 2 [link] [source]

Many thanks!