I used the following compile flags: -flto=4 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing
I got this error:
libtool: link: x86_64-pc-linux-gnu-gcc -shared -fPIC -DPIC .libs/xconvolve.o .libs/xfax.o .libs/xgrayout.o .libs/xjpg_dct.o .libs/xjpg_fix.o .libs/xpad.o .libs/xrotate.o .libs/xskel.o .libs/xtiff.o .libs/ipmain.o .libs/xchgbpp.o .libs/xcrop.o .libs/xgamma.o .libs/xjpg_dec.o .libs/xjpg_huf.o .libs/xpcx.o .libs/xsaturation.o .libs/xtable.o .libs/xtonemap.o .libs/xbi2gray.o .libs/xcolrspc.o .libs/xfakemono.o .libs/xgray2bi.o .libs/xinvert.o .libs/xjpg_enc.o .libs/xmatrix.o .libs/xpnm.o .libs/xscale.o .libs/xthumb.o .libs/xyxtract.o -Wl,--as-needed -lavahi-common -lavahi-client -lcrypto -ldl -lm -march=native -fstack-protector-all -O2 -fdiagnostics-color=always -frecord-gcc-switches -Werror=format-security -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types -Wl,-O1 -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-soname -Wl,libhpip.so.0 -o .libs/libhpip.so.0.0.1
prnt/hpcups/ColorMaps.h:47:22: error: type of 'ucMapDJ4100_KCMY_Photo_BestA_12x12x1' does not match original declaration [-Werror=lto-type-mismatch]
47 | extern unsigned char ucMapDJ4100_KCMY_Photo_BestA_12x12x1[17 * 17 * 17];
| ^
prnt/hpcups/dj4100ColorMaps.cpp:1450:15: note: array types have different bounds
1450 | unsigned char ucMapDJ4100_KCMY_Photo_BestA_12x12x1[] =
| ^
prnt/hpcups/dj4100ColorMaps.cpp:1450:15: note: 'ucMapDJ4100_KCMY_Photo_BestA_12x12x1' was previously declared here
prnt/hpcups/ColorMaps.h:2:17: error: type of 'ulMapDJ400_CMY' does not match original declaration [-Werror=lto-type-mismatch]
2 | extern uint32_t ulMapDJ400_CMY[9 * 9 * 9];
| ^
prnt/hpcups/dj400ColorMaps.cpp:118:15: note: type 'long unsigned int' should match type 'uint32_t'
118 | unsigned long ulMapDJ400_CMY[ 9 * 9 * 9 ]=
| ^
prnt/hpcups/dj400ColorMaps.cpp:118:15: note: 'ulMapDJ400_CMY' was previously declared here
prnt/hpcups/dj400ColorMaps.cpp:118:15: note: code may be misoptimized unless '-fno-strict-aliasing' is used
libtool: link: (cd ".libs" && rm -f "libhpdiscovery.so.0" && ln -s "libhpdiscovery.so.0.0.1" "libhpdiscovery.so.0")
libtool: link: (cd ".libs" && rm -f "libhpdiscovery.so" && ln -s "libhpdiscovery.so.0.0.1" "libhpdiscovery.so")
libtool: link: ( cd ".libs" && rm -f "libhpdiscovery.la" && ln -s "../libhpdiscovery.la" "libhpdiscovery.la" )
/bin/sh ./libtool --tag=CC --mode=link x86_64-pc-linux-gnu-gcc -DMUDNAME=\"hpmud\" -DCONFDIR=\"/etc/hp\" -Iprotocol -I/usr/include/libusb-1.0 -Iprotocol/discovery -march=native -fstack-protector-all -O2 -pipe -fdiagnostics-color=always -frecord-gcc-switches -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -fstack-clash-protection -Wformat -Werror=format-security -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -Werror=implicit-function-declaration -Werror=implicit-int -Werror=int-conversion -Werror=incompatible-pointer-types -I/usr/include/python3.11 -I/usr/include/python3.11 -DCONFDIR=\"/etc/hp\" -version-info 0:6:0 -lpthread -ldl -lusb-1.0 -lnetsnmp -lcrypto -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -o libhpmud.la -rpath /usr/lib64 libhpmud_la-hpmud.lo libhpmud_la-mlc.lo libhpmud_la-model.lo libhpmud_la-pml.lo libhpmud_la-dot4.lo libhpmud_la-jd.lo libhpmud_la-pp.lo libhpmud_la-utils.lo libhpmud_la-musb.lo libhpdiscovery.la -lavahi-common -lavahi-client -lcrypto -ldl -lm
lto1: some warnings being treated as errors
lto-wrapper: fatal error: x86_64-pc-linux-gnu-g++ 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
Previously reported downstream as https://bugs.gentoo.org/861851