Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 807598 - sys-devel/gcc: ICE (internal compiler error) with gcc-11 when building kde-plasma/kwin (LTO with older archives)
Summary: sys-devel/gcc: ICE (internal compiler error) with gcc-11 when building kde-pl...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 808905 809836 (view as bug list)
Depends on:
Blocks: lto
  Show dependency tree
 
Reported: 2021-08-10 17:44 UTC by Johannes Hirte
Modified: 2023-02-13 07:16 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Hirte 2021-08-10 17:44:23 UTC
emerge kde-plasma/kwin results in an ICE:

[91/1024] : && /usr/bin/x86_64-pc-linux-gnu-g++ -fPIC -O2 -flto=8 -fuse-linker-plugin -march=znver1 -mtune=znver1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -ftree-vectorize -fvect-cost-model -pipe -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -Wsuggest-override -Wlogical-op -fdiagnostics-color=always  -Wl,--no-undefined -Wl,--enable-new-dtags -Wl,-O1 -Wl,--as-needed -shared  -o bin/kcm_kwin4_genericscripted.so src/scripting/CMakeFiles/kcm_kwin4_genericscripted.dir/kcm_kwin4_genericscripted_autogen/mocs_compilation.cpp.o src/scripting/CMakeFiles/kcm_kwin4_genericscripted.dir/genericscriptedconfig.cpp.o src/scripting/CMakeFiles/kcm_kwin4_genericscripted.dir/kwineffects_interface.cpp.o  /usr/lib64/libKF5ConfigWidgets.so.5.84.0  /usr/lib64/libKF5Service.so.5.84.0  /usr/lib64/libKF5Codecs.so.5.84.0  /usr/lib64/libKF5WidgetsAddons.so.5.84.0  /usr/lib64/libKF5ConfigGui.so.5.84.0  /usr/lib64/libKF5Auth.so.5.84.0  /usr/lib64/libKF5AuthCore.so.5.84.0  /usr/lib64/libKF5I18n.so.5.84.0  /usr/lib64/libKF5ConfigCore.so.5.84.0  /usr/lib64/libKF5CoreAddons.so.5.84.0  /usr/lib64/libQt5Xml.so.5.15.2  /usr/lib64/libQt5DBus.so.5.15.2  /usr/lib64/libQt5UiTools.a  /usr/lib64/libQt5Widgets.so.5.15.2  /usr/lib64/libQt5Gui.so.5.15.2  /usr/lib64/libQt5Core.so.5.15.2  /usr/lib64//libQt5Widgets.so  /usr/lib64//libQt5Gui.so  /usr/lib64//libQt5Core.so  /usr/lib64//libQt5Widgets.so  /usr/lib64//libQt5Gui.so  /usr/lib64//libQt5Core.so  -lpthread  /usr/lib64/libGL.so && :
FAILED: bin/kcm_kwin4_genericscripted.so 
: && /usr/bin/x86_64-pc-linux-gnu-g++ -fPIC -O2 -flto=8 -fuse-linker-plugin -march=znver1 -mtune=znver1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -ftree-vectorize -fvect-cost-model -pipe -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -Wsuggest-override -Wlogical-op -fdiagnostics-color=always  -Wl,--no-undefined -Wl,--enable-new-dtags -Wl,-O1 -Wl,--as-needed -shared  -o bin/kcm_kwin4_genericscripted.so src/scripting/CMakeFiles/kcm_kwin4_genericscripted.dir/kcm_kwin4_genericscripted_autogen/mocs_compilation.cpp.o src/scripting/CMakeFiles/kcm_kwin4_genericscripted.dir/genericscriptedconfig.cpp.o src/scripting/CMakeFiles/kcm_kwin4_genericscripted.dir/kwineffects_interface.cpp.o  /usr/lib64/libKF5ConfigWidgets.so.5.84.0  /usr/lib64/libKF5Service.so.5.84.0  /usr/lib64/libKF5Codecs.so.5.84.0  /usr/lib64/libKF5WidgetsAddons.so.5.84.0  /usr/lib64/libKF5ConfigGui.so.5.84.0  /usr/lib64/libKF5Auth.so.5.84.0  /usr/lib64/libKF5AuthCore.so.5.84.0  /usr/lib64/libKF5I18n.so.5.84.0  /usr/lib64/libKF5ConfigCore.so.5.84.0  /usr/lib64/libKF5CoreAddons.so.5.84.0  /usr/lib64/libQt5Xml.so.5.15.2  /usr/lib64/libQt5DBus.so.5.15.2  /usr/lib64/libQt5UiTools.a  /usr/lib64/libQt5Widgets.so.5.15.2  /usr/lib64/libQt5Gui.so.5.15.2  /usr/lib64/libQt5Core.so.5.15.2  /usr/lib64//libQt5Widgets.so  /usr/lib64//libQt5Gui.so  /usr/lib64//libQt5Core.so  /usr/lib64//libQt5Widgets.so  /usr/lib64//libQt5Gui.so  /usr/lib64//libQt5Core.so  -lpthread  /usr/lib64/libGL.so && :
lto1: internal compiler error: Segmentation fault
0xd5cd5b internal_error(char const*, ...)
        ???:0
0xe64bbe bp_unpack_string(data_in*, bitpack_d*)
        ???:0
0x12d8cdd cl_optimization_stream_in(data_in*, bitpack_d*, cl_optimization*)
        ???:0
0xe61c32 streamer_read_tree_bitfields(lto_input_block*, data_in*, tree_node*)
        ???:0
0xe5e5d4 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int)
        ???:0
0xe5f642 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned int*, bool)
        ???:0
0xe56a63 read_cgraph_and_symbols(unsigned int, char const**)
        ???:0
0x12d6256 lto_main()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status

This is reproducible with sys-devel/gcc-11.1.0-r2 and sys-devel/gcc-11.2.0

Reproducible: Always




emerge --info
Portage 3.0.20 (python 3.7.10-final-0, default/linux/amd64/17.1/systemd, gcc-11.1.0, glibc-2.33-r5, 5.14.0-rc5 x86_64)
=================================================================
System uname: Linux-5.14.0-rc5-x86_64-AMD_Ryzen_5_PRO_2500U_w-_Radeon_Vega_Mobile_Gfx-with-gentoo-2.7
KiB Mem:    15283068 total,    770352 free
KiB Swap:    2097148 total,   1513432 free
Head commit of repository gentoo: b39ee3a887dbb20538208e7a6cab0d018ab32766

Head commit of repository kde: d9bda513778a9aefe441878f0fabb8590cfedf4a

Head commit of repository qt: 1888cd012eaaa80f0eb5d6c6fb01e54a9f7a7b84

Head commit of repository x11: 308a1716b7915e524a73298e0751d7ab4bf8d76f

sh bash 5.1_p8
ld GNU ld (Gentoo 2.36.1 p4) 2.36.1
distcc 3.4 x86_64-pc-linux-gnu [disabled]
ccache version 4.3 [disabled]
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.34.0-r1::gentoo
dev-lang/python:          2.7.18_p11::gentoo, 3.8.11::gentoo, 3.9.6_p1::gentoo, 3.10.0_rc1_p1::gentoo
dev-lang/rust:            1.54.0::gentoo
dev-util/ccache:          4.3-r3::gentoo
dev-util/cmake:           3.21.1::gentoo
sys-apps/baselayout:      2.7-r3::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.4::gentoo
sys-devel/binutils:       2.36.1-r2::gentoo
sys-devel/gcc:            11.1.0-r2::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33-r5::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/repo/gentoo.git
    priority: -1000

kde
    location: /var/db/repos/kde
    sync-type: git
    sync-uri: git://anongit.gentoo.org/proj/kde.git
    masters: gentoo
    priority: 50

local
    location: /var/db/repos/local
    masters: gentoo
    priority: 50

qt
    location: /var/db/repos/qt
    sync-type: git
    sync-uri: git://anongit.gentoo.org/proj/qt.git
    masters: gentoo
    priority: 50

steam-overlay
    location: /var/db/repos/steam-overlay
    masters: gentoo
    priority: 50

x11
    location: /var/db/repos/x11
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/proj/x11.git
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=znver1 -mtune=znver1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -ftree-vectorize -fvect-cost-model -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/easy-rsa /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php8.0/ext-active/ /etc/php/cgi-php8.0/ext-active/ /etc/php/cli-php8.0/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -march=znver1 -mtune=znver1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -ftree-vectorize -fvect-cost-model -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--with-bdeps=y --quiet-build=n"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -march=znver1 -mtune=znver1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -ftree-vectorize -fvect-cost-model -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync metadata-transfer multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=znver1 -mtune=znver1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -ftree-vectorize -fvect-cost-model -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de en"
MAKEOPTS="-j8 -l8"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="X a52 aac aacplus acl activities alsa alt-svc amd64 amr amrenc anacron avif blake2 bluetooth brotli bzip2 cairo caps celt chm cleartype_hinting cli corefonts crypt cryptsetup cups d3d9 dav1d dbus dell device-mapper djvu dri drm dvd ebook editorconfig efi egl eps epub evdev exif faac fdk ffmpeg fftw flac fontconfig fortran gbm gdbm gif git glamor glslang gmp gold gpg gphoto2 gpm graphviz harfbuzz heif http2 hwloc iconv icu id3tag io-uring ipv6 ithreads jpeg kate kipi lcms lensfun libaom libatomic libcxx libcxxabi libde265 libffi libglvnd libinput libkms libsamplerate libtirpc libunwind libxml2 lm-sensors lz4 lzma lzo mad matroska mjpeg mmap mng mobi modern-top mp3 mpeg mtp multilib mysql ncurses networkmanager nfs nls nptl ogg openal opencv openexr opengl openmp openssl opus pam parted pcre pcre16 pdf png policykit postscript pulseaudio python qml qt5 rav1e raw readline rtmp s3tc schroedinger screencast sdl sdl2 seccomp sift smp sndfile sox speex spice split-usr sqlite ssl subversion svg svt-av1 system-jsoncpp system-sqlite system-zlib systemd taglib tcpd tesseract theora threads thumbnail tiff truetype udev uefi unicode urandom usb usbredir user-session v4l vaapi vde vdpau vhosts virgl virt-network virtfs vorbis vpx vte vulkan wavpack wayland webp wmf x264 x265 xattr xcb xcomposite xkb xml xmp xpm xv xvid xxhash zink zip zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" CAMERAS="canon ricoh ricoh_g3" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sha sse sse2 sse3 ssse3 sse4_1 sse4_2" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-32 efi-64 pc" INPUT_DEVICES="evdev libinput synaptics" KERNEL="linux" L10N="de en" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="AMDGPU BPF NVPTX X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1 lua5-3 lua5-4 luajit" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_8 python3_9 python3_10 pypy3" QEMU_SOFTMMU_TARGETS="aarch64 arm i386 x86_64" QEMU_USER_TARGETS="aarch64 arm" RUBY_TARGETS="ruby27 ruby30" USERLAND="GNU" VIDEO_CARDS="amdgpu" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RUSTFLAGS
Comment 2 Johannes Hirte 2021-08-10 17:48:09 UTC
minimized test case minimized.cpp:

class QObject;
class QUiLoader {
public:
  QUiLoader(QObject * = nullptr);
};
void GenericScriptedConfigcreateUi() { QUiLoader loader; }

leads to:

/usr/bin/x86_64-pc-linux-gnu-g++ -fPIC -O2 -flto=8 -fuse-linker-plugin -march=znver1 -mtune=znver1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=512 -ftree-vectorize -fvect-cost-model -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Wvla -Wdate-time -Wsuggest-override -Wlogical-op -fdiagnostics-color=always  -Wl,--no-undefined -Wl,--enable-new-dtags -Wl,-O1 -Wl,--as-needed -shared  -o minimized.so minimized.cpp /usr/lib64/libKF5ConfigWidgets.so.5.84.0  /usr/lib64/libKF5Service.so.5.84.0  /usr/lib64/libKF5Codecs.so.5.84.0  /usr/lib64/libKF5WidgetsAddons.so.5.84.0  /usr/lib64/libKF5ConfigGui.so.5.84.0  /usr/lib64/libKF5Auth.so.5.84.0  /usr/lib64/libKF5AuthCore.so.5.84.0  /usr/lib64/libKF5I18n.so.5.84.0  /usr/lib64/libKF5ConfigCore.so.5.84.0  /usr/lib64/libKF5CoreAddons.so.5.84.0  /usr/lib64/libQt5Xml.so.5.15.2  /usr/lib64/libQt5DBus.so.5.15.2  /usr/lib64/libQt5UiTools.a  /usr/lib64/libQt5Widgets.so.5.15.2  /usr/lib64/libQt5Gui.so.5.15.2  /usr/lib64/libQt5Core.so.5.15.2  /usr/lib64//libQt5Widgets.so  /usr/lib64//libQt5Gui.so  /usr/lib64//libQt5Core.so  /usr/lib64//libQt5Widgets.so  /usr/lib64//libQt5Gui.so  /usr/lib64//libQt5Core.so  -lpthread  /usr/lib64/libGL.so
/var/tmp/portage/dev-qt/designer-5.15.2/work/qttools-everywhere-src-5.15.2/src/designer/src/uitools/quiloader.h:68:7: warning: type ‘struct QUiLoader’ violates the C++ One Definition Rule [-Wodr]
genericscriptedconfig.cpp.ii:2:7: note: a type with different bases is defined in another translation unit
    2 | class QUiLoader {
      |       ^
lto1: internal compiler error: Segmentation fault
0xd5cd5b internal_error(char const*, ...)
        ???:0
0xe64bbe bp_unpack_string(data_in*, bitpack_d*)
        ???:0
0x12d8cdd cl_optimization_stream_in(data_in*, bitpack_d*, cl_optimization*)
        ???:0
0xe61c32 streamer_read_tree_bitfields(lto_input_block*, data_in*, tree_node*)
        ???:0
0xe5e5d4 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int)
        ???:0
0xe5f642 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned int*, bool)
        ???:0
0xe56a63 read_cgraph_and_symbols(unsigned int, char const**)
        ???:0
0x12d6256 lto_main()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Comment 3 Johannes Hirte 2021-08-10 17:52:35 UTC
reduced compiler flags:

/usr/bin/x86_64-pc-linux-gnu-g++ -fPIC -flto=8 -fuse-linker-plugin -shared  -o minimized.so minimized.cpp /usr/lib64/libKF5ConfigWidgets.so.5.84.0  /usr/lib64/libKF5Service.so.5.84.0  /usr/lib64/libKF5Codecs.so.5.84.0  /usr/lib64/libKF5WidgetsAddons.so.5.84.0  /usr/lib64/libKF5ConfigGui.so.5.84.0  /usr/lib64/libKF5Auth.so.5.84.0  /usr/lib64/libKF5AuthCore.so.5.84.0  /usr/lib64/libKF5I18n.so.5.84.0  /usr/lib64/libKF5ConfigCore.so.5.84.0  /usr/lib64/libKF5CoreAddons.so.5.84.0  /usr/lib64/libQt5Xml.so.5.15.2  /usr/lib64/libQt5DBus.so.5.15.2  /usr/lib64/libQt5UiTools.a  /usr/lib64/libQt5Widgets.so.5.15.2  /usr/lib64/libQt5Gui.so.5.15.2  /usr/lib64/libQt5Core.so.5.15.2  /usr/lib64//libQt5Widgets.so  /usr/lib64//libQt5Gui.so  /usr/lib64//libQt5Core.so  /usr/lib64//libQt5Widgets.so  /usr/lib64//libQt5Gui.so  /usr/lib64//libQt5Core.so  -lpthread  /usr/lib64/libGL.so/var/tmp/portage/dev-qt/designer-5.15.2/work/qttools-everywhere-src-5.15.2/src/designer/src/uitools/quiloader.h:68:7: warning: type ‘struct QUiLoader’ violates the C++ One Definition Rule [-Wodr]
minimized.cpp:2:7: note: a type with different bases is defined in another translation unit
    2 | class QUiLoader {
      |       ^
lto1: internal compiler error: Segmentation fault
0xd5cd5b internal_error(char const*, ...)
        ???:0
0xe64bbe bp_unpack_string(data_in*, bitpack_d*)
        ???:0
0x12d8cdd cl_optimization_stream_in(data_in*, bitpack_d*, cl_optimization*)
        ???:0
0xe61c32 streamer_read_tree_bitfields(lto_input_block*, data_in*, tree_node*)
        ???:0
0xe5e5d4 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int)
        ???:0
0xe5f642 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned int*, bool)
        ???:0
0xe56a63 read_cgraph_and_symbols(unsigned int, char const**)
        ???:0
0x12d6256 lto_main()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.gentoo.org/> for instructions.
lto-wrapper: fatal error: /usr/bin/x86_64-pc-linux-gnu-g++ returned 1 exit status
compilation terminated.
/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/../../../../x86_64-pc-linux-gnu/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
Comment 4 Johannes Hirte 2021-08-10 20:24:32 UTC
Most minimized example

/usr/bin/x86_64-pc-linux-gnu-g++ -o minimized.so minimized.cpp /usr/lib64/libQt5UiTools.a

/usr/lib64/libQt5UiTools.a belongs to dev-qt/designer-5.15.2. I've already rebuild this and it didn't changed anything. Another rebuild seems at least to fix the minimal example.
Comment 5 Johannes Hirte 2021-08-10 20:38:36 UTC
Okay, with the second re-emerge of dev-qt/designer, build of kde-plasma/kwin did without problem. Don't know what's the different now, but the ICE is gone. I think there is still a bug in gcc. At least it's not robust for bad input. Sadly I can't debug this any further.
Comment 6 Mike Gilbert gentoo-dev 2021-08-12 17:29:44 UTC
Giving this to toolchain in case they want to investigate.
Comment 7 Sergei Trofimovich 2021-08-13 15:57:12 UTC
> -flto=8

This bug is a SIGSEGV in gcc's LTO streamer that reading existing GIMPLE:

lto1: internal compiler error: Segmentation fault
0xd5cd5b internal_error(char const*, ...)
0xe64bbe bp_unpack_string(data_in*, bitpack_d*)
0x12d8cdd cl_optimization_stream_in(data_in*, bitpack_d*, cl_optimization*)
0xe61c32 streamer_read_tree_bitfields(lto_input_block*, data_in*, tree_node*)
0xe5e5d4 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int)
0xe5f642 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned int*, bool)
0xe56a63 read_cgraph_and_symbols(unsigned int, char const**)
0x12d6256 lto_main()

LTO has a lot stricter constraints on how cross-version is checked (compared to .o files with object code). The check is in https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/lto-streamer.c;h=84db5eb944d80eb0c811e2eafc7732c7d8a17880;hb=HEAD#l259

Note that LTO_major / LTO_minor used to be maintained separately. Sometimes bumps were missed. Recent fix for gcc-12+ should get version skew sorted at least between major versions:

    https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=e3a682f4197f9f39808febfd1862e722d7675d34

  -#define LTO_major_version 9
  +#define LTO_major_version GCC_major_version
   #define LTO_minor_version 0

Older gccs are still affected.

SIGSEGV also means that bytecode validation is incomplete.

The bug is also triggered by using .a files from packages built at a different time. You would probably need to mitigate it somehow on your system: you need to rebuild them every time compiler changes enough.

And I wonder if use of .a files could be avoided across packages.
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-08-23 17:51:55 UTC
*** Bug 809836 has been marked as a duplicate of this bug. ***
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-08-23 17:52:03 UTC
*** Bug 808905 has been marked as a duplicate of this bug. ***