I tried building gpm from git with -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing in CFLAGS / LDFLAGS. It failed to build with the following error:
gcc -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Wl,--defsym=__gentoo_check_ldflags__=0 -L/tmp/gpm/src -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -o gpm mice.o twiddler.o synaptics.o daemon/add_mouse.o daemon/init_mice.o daemon/reset_mice.o daemon/build_argv.o daemon/disable_paste.o daemon/do_client.o daemon/do_selection.o daemon/get_console_size.o daemon/get_data.o daemon/getmousedata.o daemon/gpm.o daemon/gpm-killed.o daemon/header.o daemon/main.o daemon/old_main.o daemon/open_console.o daemon/check_kill.o daemon/gpm_exited.o generic/isodigit.o generic/getsym.o daemon/processspecial.o daemon/processconn.o daemon/processmouse.o daemon/processrequest.o daemon/selection_copy.o daemon/selection_paste.o daemon/cmdline.o daemon/loadlut.o daemon/find_mouse_by_name.o daemon/usage.o daemon/check_uniqueness.o daemon/startup.o daemon/wait_text.o report.o tools.o -lm
/tmp/gpm/src/headers/daemon.h:175:25: error: type of ‘cinfo’ does not match original declaration [-Werror=lto-type-mismatch]
175 | extern Gpm_Cinfo *cinfo[MAX_VC+1];
| ^
daemon/gpm.c:96:12: note: array types have different bounds
96 | Gpm_Cinfo *cinfo[MAX_VC+1];
| ^
daemon/gpm.c:96:12: note: ‘cinfo’ was previously declared here
lto1: some warnings being treated as errors
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:85: gpm] Error 1
I tried building gpm from git with
-flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
in CFLAGS / LDFLAGS. It failed to build with the following error:See also: https://bugs.gentoo.org/885323