fvwmorg / fvwm3

FVWM version 3 -- the successor to fvwm2
Other
505 stars 79 forks source link

<=1.1.0: LTO type mismatch #1056

Open Kangie opened 3 weeks ago

Kangie commented 3 weeks ago

Upfront Information

Please provide the following information by running the command and providing the output.

1.1.0 on Gentoo Linux

Expected Behaviour

CFLAGS="-flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing"
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --disable-dependency-tracking --disable-silent-rules --docdir=/usr/share/doc/fvwm3-1.1.0-r1 --htmldir=/usr/share/doc/fvwm3-1.1.0-r1/html --libdir=/usr/lib64 --with-imagepath=/usr/include/X11/bitmaps:/usr/include/X11/pixmaps:/usr/share/icons/fvwm --enable-package-subdirs --disable-bidi --enable-golang --enable-nls --enable-iconv --disable-perllib --with-readline-library --enable-rsvg --enable-png --disable-mandoc --disable-htmldoc --without-termcap-library
make -j
.  .  .

Actual Behaviour

../libs/Colorset.h:86:20: error: type of ‘Colorset’ does not match original declaration [-Werror=lto-type-mismatch]
   86 | extern colorset_t *Colorset;
      |                    ^
../libs/Colorset.c:36:13: note: ‘Colorset’ was previously declared here
   36 | colorset_t *Colorset = NULL;
      |             ^
../libs/Colorset.c:36:13: note: code may be misoptimized unless ‘-fno-strict-aliasing’ is used
lto1: some warnings being treated as errors
lto-wrapper: fatal error: 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

Steps to Reproduce

This is fixed in the meson build PR: https://github.com/fvwmorg/fvwm3/pull/996/commits/5215ec25918255e5e708420caacc1b6fa98d74f2

See Also:

https://bugs.gentoo.org/864959

ThomasAdam commented 3 weeks ago

I'm very much aware of this, but the work we're doing with Meson should help.

That being said, seeing as we'll be supporting both meson and autotools side-by-side, is there anything we need to consider here for autotools?

Kangie commented 3 weeks ago

AFAIK, no; there's no build system changes for LTO - that's all in compiler / CFLAGS territory.

All we really need is one (or more) CI runs that attempt LTO with the warning flags to pick up any other occurrences ( I don't believe that there are any, this should just prevent it happening again in the future).