./configure CFLAGS='-flto -O2' triggers lto-type-mismatch warnings between src/igloo.c and src/ro.c
When building with gcc-13.0.1 and link-time optimization is enabled (-flto), the compiler warns about mismatching function prototypes among compilation units:
/bin/sh ./libtool --tag=CC --mode=link gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -fasynchronous-unwind-tables -fstack-clash-protection -Wextra -pthread -Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -o libigloo.la -rpath /usr/lib64 src/igloo.lo src/error.lo src/rwlock.lo src/time.lo src/feature.lo src/list.lo src/digest.lo src/prng.lo src/cs.lo src/sp.lo src/ro.lo src/tap.lo src/uuid.lo -lm -lrhash -lpthread
libtool: link: gcc -shared -fPIC -DPIC src/.libs/igloo.o src/.libs/error.o src/.libs/rwlock.o src/.libs/time.o src/.libs/feature.o src/.libs/list.o src/.libs/digest.o src/.libs/prng.o src/.libs/cs.o src/.libs/sp.o src/.libs/ro.o src/.libs/tap.o src/.libs/uuid.o -lm -lrhash -lpthread -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -O2 -flto=auto -g -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=z13 -mtune=z14 -Wl,-z -Wl,relro -Wl,--as-needed -Wl,-z -Wl,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes -pthread -Wl,-soname -Wl,libigloo.so.0 -o .libs/libigloo.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libigloo.so.0" && ln -s "libigloo.so.0.0.0" "libigloo.so.0")
libtool: link: (cd ".libs" && rm -f "libigloo.so" && ln -s "libigloo.so.0.0.0" "libigloo.so")
libtool: link: ( cd ".libs" && rm -f "libigloo.la" && ln -s "../libigloo.la" "libigloo.la" )
make[1]: Leaving directory '/builddir/build/BUILD/libigloo-0.9.2'
./include/igloo/ro.h:178:17: warning: type of 'igloo_ro_ref_raw' does not match original declaration [-Wlto-type-mismatch]
178 | igloo_error_t igloo_ro_ref_raw(igloo_ro_t self, igloo_ro_t *out, const igloo_ro_type_t *type);
| ^
src/ro.c:446:17: note: type mismatch in parameter 1
446 | igloo_error_t igloo_ro_ref_raw(igloo_ro_t self, igloo_ro_t *out, const igloo_ro_type_t *type)
| ^
src/ro.c:446:17: note: 'igloo_ro_ref_raw' was previously declared here
src/ro.c:446:17: note: code may be misoptimized unless '-fno-strict-aliasing' is used
./include/igloo/ro.h:183:17: warning: type of 'igloo_ro_weak_ref_replace_raw' does not match original declaration [-Wlto-type-mismatch]
183 | igloo_error_t igloo_ro_weak_ref_replace_raw(igloo_ro_t self, igloo_ro_t *out, const igloo_ro_type_t *type);
| ^
src/ro.c:658:17: note: type mismatch in parameter 1
658 | igloo_error_t igloo_ro_weak_ref_replace_raw(igloo_ro_t self, igloo_ro_t *out, const igloo_ro_type_t *type)
| ^
src/ro.c:658:17: note: 'igloo_ro_weak_ref_replace_raw' was previously declared here
src/ro.c:658:17: note: code may be misoptimized unless '-fno-strict-aliasing' is used
src/private.h:72:12: warning: type of 'igloo_ro_get_instance_unsafe' does not match original declaration [-Wlto-type-mismatch]
72 | igloo_ro_t igloo_ro_get_instance_unsafe(igloo_ro_t self, const igloo_ro_type_t *type);
| ^
src/ro.c:974:12: note: return value type mismatch
974 | igloo_ro_t igloo_ro_get_instance_unsafe(igloo_ro_t self, const igloo_ro_type_t *type)
| ^
src/ro.c:974:12: note: 'igloo_ro_get_instance_unsafe' was previously declared here
src/ro.c:974:12: note: code may be misoptimized unless '-fno-strict-aliasing' is used
./include/igloo/ro.h:189:17: warning: type of 'igloo_ro_stringify_raw' does not match original declaration [-Wlto-type-mismatch]
189 | igloo_error_t igloo_ro_stringify_raw(igloo_ro_t self, char **result, igloo_ro_sy_t flags, const igloo_ro_type_t *type);
| ^
src/ro.c:757:17: note: type mismatch in parameter 1
757 | igloo_error_t igloo_ro_stringify_raw(igloo_ro_t self, char **result, igloo_ro_sy_t flags, const igloo_ro_type_t *type)
| ^
src/ro.c:757:17: note: 'igloo_ro_stringify_raw' was previously declared here
src/ro.c:757:17: note: code may be misoptimized unless '-fno-strict-aliasing' is used
./include/igloo/ro.h:175:12: warning: type of 'igloo_RO_TO_TYPE_raw' does not match original declaration [-Wlto-type-mismatch]
175 | igloo_ro_t igloo_RO_TO_TYPE_raw(igloo_ro_t object, const igloo_ro_type_t *type) igloo_ATTR_F_HOT;
| ^
src/ro.c:250:17: note: return value type mismatch
250 | igloo_ro_t igloo_RO_TO_TYPE_raw(igloo_ro_t object, const igloo_ro_type_t *type)
| ^
src/ro.c:250:17: note: 'igloo_RO_TO_TYPE_raw' was previously declared here
src/ro.c:250:17: note: code may be misoptimized unless '-fno-strict-aliasing' is used
src/private.h:74:21: warning: type of 'igloo_instance_get_prng_state' does not match original declaration [-Wlto-type-mismatch]
74 | igloo_prng_state_t *igloo_instance_get_prng_state(igloo_ro_t self, size_t *instancelen);
| ^
src/igloo.c:314:21: note: type mismatch in parameter 1
314 | igloo_prng_state_t *igloo_instance_get_prng_state(igloo_ro_t self, size_t *instancelen)
| ^
src/igloo.c:314:21: note: 'igloo_instance_get_prng_state' was previously declared here
src/igloo.c:314:21: note: code may be misoptimized unless '-fno-strict-aliasing' is used
src/private.h:73:19: warning: type of 'igloo_instance_get_stringpool_state' does not match original declaration [-Wlto-type-mismatch]
73 | igloo_sp_state_t *igloo_instance_get_stringpool_state(igloo_ro_t self);
| ^
src/igloo.c:304:19: note: type mismatch in parameter 1
304 | igloo_sp_state_t *igloo_instance_get_stringpool_state(igloo_ro_t self)
| ^
src/igloo.c:304:19: note: 'igloo_instance_get_stringpool_state' was previously declared here
src/igloo.c:304:19: note: code may be misoptimized unless '-fno-strict-aliasing' is used
While the printed lines are character by character equal, it is probably igloo_ro_t type which differ: include/igloo/types.h defines it as a union of igloo_RO_TYPE()s or as "void *" depending on igloo_ATTR_T_TRANSPARENT_UNION macro. Further, an union member "igloo_RO_TYPE(igloo_ro_stub_t)" expands to "subtype__igloo_ro_stub_t *". Hence different types. src/igloo.c and src/ro.c probably differ in a list of included header files. I agree that the GCC warning is not much helpful. The warning can be triggered with "./configure CFLAGS='-flto -O2'" command.
Problem is that GCC since -O2 optimization level assumes that pointers to different types cannot alias to the same memory and optimizes the code so. This can lead to undefined run-time execution. A brief introduction to strict aliasing can be found at https://www.geeksforgeeks.org/strict-aliasing-rule-in-c-with-examples/.