This bug report is for awareness to an ICE in LLVM/clang when built with GCC using the -flto flags, both upstreams are aware of it but after discussing with Sam on IRC we felt having a record of it here would be a good idea. This has been confirmed on two machines both on ~amd64 but one is using glibc and and the other musl. Reproducible: Always Steps to Reproduce: 1. Add -flto to flags 2. Emerge llvm and clang 3. Emerge compiler-rt or compiler-rt-sanitizers Actual Results: ICE error as shown in the build log. This has been tested in a stable amd64 chroot to make sure it wasn't a clang15 issue but the problem still occurs and I tried to build it with the latest ebuilds of all affected packages with the same error. I do have machines to do further testing if anyone has suggestions but personally I think this one is an upstream issue.
Portage 3.0.34 (python 3.10.6-final-0, default/linux/amd64/17.1/desktop, gcc-12.2.0, glibc-2.35-r8, 5.18.18-gentoo-dist x86_64) ================================================================= System uname: Linux-5.18.18-gentoo-dist-x86_64-Intel-R-_Core-TM-_i7-6700K_CPU_@_4.00GHz-with-glibc2.35 KiB Mem: 16349108 total, 3705544 free KiB Swap: 16777212 total, 13171596 free Timestamp of repository gentoo: Mon, 22 Aug 2022 08:30:01 +0000 Head commit of repository gentoo: 7bdffd3c949c20c4fc11e02663dd68bccb492891 Timestamp of repository steam-overlay: Sun, 21 Aug 2022 12:16:52 +0000 Head commit of repository steam-overlay: 9a0be1adc163aa25f3e85c2c182954a5ac78f507 sh bash 5.1_p16-r1 ld GNU ld (Gentoo 2.38 p4) 2.38 distcc 3.4 x86_64-pc-linux-gnu [disabled] app-misc/pax-utils: 1.3.5::gentoo app-shells/bash: 5.1_p16-r1::gentoo dev-java/java-config: 2.3.1::gentoo dev-lang/perl: 5.36.0::gentoo dev-lang/python: 3.10.6_p2::gentoo, 3.11.0_rc1::gentoo dev-lang/rust: 1.62.1::gentoo dev-util/cmake: 3.24.1::gentoo dev-util/meson: 0.63.1::gentoo sys-apps/baselayout: 2.8-r2::gentoo sys-apps/openrc: 0.45.2::gentoo sys-apps/sandbox: 2.29::gentoo sys-devel/autoconf: 2.13-r2::gentoo, 2.71-r1::gentoo sys-devel/automake: 1.16.5::gentoo sys-devel/binutils: 2.38-r2::gentoo sys-devel/binutils-config: 5.4.1::gentoo sys-devel/clang: 14.0.6-r1::gentoo sys-devel/gcc: 12.2.0::gentoo sys-devel/gcc-config: 2.5-r1::gentoo sys-devel/libtool: 2.4.7::gentoo sys-devel/lld: 14.0.6::gentoo sys-devel/llvm: 14.0.6-r2::gentoo sys-devel/make: 4.3::gentoo sys-kernel/linux-headers: 5.19::gentoo (virtual/os-headers) sys-libs/glibc: 2.35-r8::gentoo Repositories: gentoo location: /var/db/repos/gentoo sync-type: rsync sync-uri: rsync://rsync.gentoo.org/gentoo-portage priority: -1000 sync-rsync-verify-jobs: 1 sync-rsync-extra-opts: sync-rsync-verify-metamanifest: yes sync-rsync-verify-max-age: 24 cinnamon location: /var/db/repos/cinnamon masters: gentoo steam-overlay location: /var/db/repos/steam-overlay sync-type: git sync-uri: https://github.com/gentoo-mirror/steam-overlay.git masters: gentoo ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=8 -fuse-linker-plugin -falign-functions=32" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /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/revdep-rebuild /etc/sandbox.d /etc/terminfo" CXXFLAGS="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=8 -fuse-linker-plugin -falign-functions=32" DISTDIR="/var/cache/distfiles" 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="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=8 -fuse-linker-plugin -falign-functions=32" FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr" FFLAGS="-march=native -O2 -pipe -fgraphite-identity -floop-nest-optimize -fdevirtualize-at-ltrans -fipa-pta -fno-semantic-interposition -flto=8 -fuse-linker-plugin -falign-functions=32" GENTOO_MIRRORS="http://distfiles.gentoo.org" LANG="en_GB.utf8" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j8" 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" SHELL="/bin/bash" USE="X a52 aac acl acpi alsa amd64 bluetooth branding bzip2 cairo cdda cdr cli crypt cups d3d9 dbus dist-kernel dri dts dvd dvdr elogind encode evdev exif flac fortran gdbm gif gpm graphite gtk gtk3 gui iconv icu introspection ipv6 jpeg lcms libglvnd libnotify libtirpc lto mad mng mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf pgo png policykit ppds pulseaudio readline sdl seccomp spell split-usr ssl startup-notification svg tiff truetype udev udisks unicode upower usb vaapi vdpau vorbis vulkan vulkan-overlay wxwidgets x264 xattr xcb xinerama xml xv xvid zlib" ABI_X86="64 32" ADA_TARGET="gnat_2020" 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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 f16c fma3 pclmul popcnt rdrand sse3 sse4_1 sse4_2 ssse3" 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" INPUT_DEVICES="lininput evdev joystick" KERNEL="linux" L10N="en en-GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="X86" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-4 php8-0" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_10" PYTHON_TARGETS="python3_10" QEMU_SOFTMMU_TARGETS="i386 ppc ppc64 riscv32 riscv64 x86_64" QEMU_USER_TARGETS="i386 ppc ppc64 riscv32 riscv64 x86_64" RUBY_TARGETS="ruby27" USERLAND="GNU" VIDEO_CARDS="nvidia intel" 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: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LEX, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
Created attachment 814801 [details] Build log - Glibc system
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c4563a5b5a22606b39f91153c9d78e2367de4dd7 commit c4563a5b5a22606b39f91153c9d78e2367de4dd7 Author: Ian Jordan <immoloism@gmail.com> AuthorDate: 2023-02-08 19:12:21 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-02-22 18:32:39 +0000 sys-devel/llvm sys-devel/clang: GCC -flto ICE mitigation GCC causes an ICE in llvm/clang when compiled with LTO, this has been tested with every version of GCC with each version of llvm/clang in tree but does not happened when clang compiles itself with LTO. This will stop many of the issues people face with using LTO systemwide on Gentoo until this get fixed upstreamed but I left the bug itself on b.g.o so this tested with each release and removed once finally solved. It's unclear if this is a GCC bug or a LLVM one (GCC miscompilation, UB in LLVM meaning "miscompiled" but it's LLVM's fault, or a bug in LLVM itself which only shows up when built with GCC). Bug: https://bugs.gentoo.org/873670 Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106943 Bug: https://github.com/llvm/llvm-project/issues/57740 Bug: https://github.com/llvm/llvm-project/issues/60877 Signed-off-by: Ian Jordan <immoloism@gmail.com> Closes: https://github.com/gentoo/gentoo/pull/29496 Signed-off-by: Sam James <sam@gentoo.org> sys-devel/clang/clang-14.0.6-r1.ebuild | 4 +++- sys-devel/clang/clang-15.0.7-r1.ebuild | 4 +++- sys-devel/clang/clang-16.0.0.9999.ebuild | 4 +++- sys-devel/clang/clang-16.0.0_rc2.ebuild | 4 +++- sys-devel/clang/clang-17.0.0.9999.ebuild | 4 +++- sys-devel/clang/clang-17.0.0_pre20230211.ebuild | 4 +++- sys-devel/clang/clang-17.0.0_pre20230218.ebuild | 4 +++- sys-devel/llvm/llvm-14.0.6-r2.ebuild | 5 +++-- sys-devel/llvm/llvm-15.0.7.ebuild | 4 +++- sys-devel/llvm/llvm-16.0.0.9999.ebuild | 4 +++- sys-devel/llvm/llvm-16.0.0_rc2.ebuild | 4 +++- sys-devel/llvm/llvm-17.0.0.9999.ebuild | 4 +++- sys-devel/llvm/llvm-17.0.0_pre20230211.ebuild | 4 +++- sys-devel/llvm/llvm-17.0.0_pre20230218.ebuild | 4 +++- 14 files changed, 42 insertions(+), 15 deletions(-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=12a806247e053ad25f6eccf5dcb39bc5f4c83bd9 commit 12a806247e053ad25f6eccf5dcb39bc5f4c83bd9 Author: Michał Górny <mgorny@gentoo.org> AuthorDate: 2023-05-15 04:55:12 +0000 Commit: Michał Górny <mgorny@gentoo.org> CommitDate: 2023-05-15 13:14:24 +0000 sys-devel/llvm: Backport UB and musl fixes to 15.0.7-r3 Closes: https://bugs.gentoo.org/873670 Closes: https://bugs.gentoo.org/905914 Signed-off-by: Michał Górny <mgorny@gentoo.org> sys-devel/llvm/Manifest | 1 + sys-devel/llvm/llvm-15.0.7-r3.ebuild | 520 +++++++++++++++++++++++++++++++++++ 2 files changed, 521 insertions(+)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6acf6385d4837b8e52399322b3b789fee9d77274 commit 6acf6385d4837b8e52399322b3b789fee9d77274 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-06-04 04:37:20 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-06-04 04:37:44 +0000 sys-devel/clang: restore filter-lto for 16.x for now We've reverted it upstream for 16.x, but will be fixed for 17. Bug: https://bugs.gentoo.org/873670 Signed-off-by: Sam James <sam@gentoo.org> sys-devel/clang/clang-16.0.4.ebuild | 4 +++- sys-devel/clang/clang-16.0.5.9999.ebuild | 4 +++- sys-devel/clang/clang-16.0.5.ebuild | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b00d86046fa4b65d76e564503de56b97f3e3d23e commit b00d86046fa4b65d76e564503de56b97f3e3d23e Author: Sam James <sam@gentoo.org> AuthorDate: 2023-06-04 04:36:19 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-06-04 04:36:41 +0000 sys-devel/llvm: restore filter-lto for 16.x for now We've reverted it upstream for 16.x, but will be fixed for 17. Thanks to Holger Hoffstätte for pointing this out. Bug: https://bugs.gentoo.org/873670 Signed-off-by: Sam James <sam@gentoo.org> sys-devel/llvm/llvm-16.0.4.ebuild | 4 +++- sys-devel/llvm/llvm-16.0.5.9999.ebuild | 4 +++- sys-devel/llvm/llvm-16.0.5.ebuild | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-)