Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 910280 - app-arch/unzip test phase hangs with -flto and append-flags -std=gnu89 [Clang16/LLVM system]
Summary: app-arch/unzip test phase hangs with -flto and append-flags -std=gnu89 [Clang...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: lto 915000
  Show dependency tree
 
Reported: 2023-07-13 06:39 UTC by unhappy-ending
Modified: 2024-03-12 01:54 UTC (History)
3 users (show)

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


Attachments
failure (unzip-gnu89-flto-hang.log,108.17 KB, text/x-log)
2023-07-13 06:39 UTC, unhappy-ending
Details
success (unzip-flto-no-hang.log,109.33 KB, text/x-log)
2023-07-13 06:40 UTC, unhappy-ending
Details
emerge --info (emerge_info.log,6.87 KB, text/x-log)
2023-11-24 04:20 UTC, ppw0
Details
lldb backtrace (lldb_bt.log,1.58 KB, text/x-log)
2023-11-24 04:20 UTC, ppw0
Details
unzip-6.0-fix-prototypes.patch (unzip-6.0-fix-prototypes.patch,52.76 KB, patch)
2023-11-25 09:21 UTC, ppw0
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description unhappy-ending 2023-07-13 06:39:12 UTC
Test phase hangs at:

>>> Test phase: app-arch/unzip-6.0_p27-r1
make -j16 -l16   check
#####  This is a Unix-specific target.  (Just so you know.)
#####     Make sure unzip, funzip and unzipsfx are compiled and
#####     in this directory.
#####  testing extraction

Noticed in the ebuild a note about Clang 16 needing append-flags -std=gnu89. This is causing my build with -flto to hang. Disabling -flto has no issue and overriding the append-flags also has no test issue. A simple test was adding -std=gnu89 back into my CFLAGS to find the exact culprit.

Reproducible: Always

Steps to Reproduce:
1. use a custom env with _FLAG_O_MATIC_ECLASS=1
2. add -flto to CFLAGS
3. run test with no hang
4. add -std=gnu89 back to CFLAGS
5. run test and watch it hang
Actual Results:  
test phase hangs when append-flags adds -std=gnu89

Expected Results:  
test to pass
Comment 1 unhappy-ending 2023-07-13 06:39:44 UTC
Created attachment 865442 [details]
failure
Comment 2 unhappy-ending 2023-07-13 06:40:01 UTC
Created attachment 865443 [details]
success
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-07-13 06:41:09 UTC
Oh, this is interesting.

Someone came in to #gentoo with this a while ago but I could only reproduce it with Clang 15 and given we were about to stable Clang 16 (and LLVM upstream's policy wrt old versions), I wasn't particularly worried.

Please include emerge --info.
Comment 4 unhappy-ending 2023-07-13 06:42:07 UTC
clang -v
clang version 16.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/16/bin
Configuration file: /etc/clang/clang.cfg
System configuration file directory: /etc/clang
Selected GCC installation: /usr/lib/gcc/x86_64-pc-linux-gnu/13
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
Found CUDA installation: /opt/cuda, version
Comment 5 unhappy-ending 2023-07-13 06:46:51 UTC
emerge --info 
Portage 3.0.49 (python 3.11.4-final-0, default/linux/amd64/17.1, gcc-13, glibc-2.37-r3, 6.3.9-gentoo-dist x86_64)
=================================================================
System uname: Linux-6.3.9-gentoo-dist-x86_64-AMD_Ryzen_9_3950X_16-Core_Processor-with-glibc2.37
KiB Mem:    32761584 total,   6505760 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Wed, 12 Jul 2023 19:01:58 +0000
Head commit of repository gentoo: 5931dd1e1ae780756df8654dd0cc1acd225c83c4

Head commit of repository audio-overlay: f68b670a42be431bed21a4e64825e0f69622f5e7

Head commit of repository brave-overlay: 1cf52b8541c7b3ce103677ebe49b6b71e16594c7

Head commit of repository cg: 0a47c429295b07f278fa210f9956bc998c7ee600

Head commit of repository guru: d5573c48a92cba4ef4d35001b47d4822f092ca37

Head commit of repository src_prepare-overlay: e348668d3a76da922b9ad16d6552ed19d794cfbd

Head commit of repository steam-overlay: f5d81890625d21bcc8e1f903cc471daab0951403

sh bash 5.2_p15-r6
ld GNU ld (Gentoo 2.40 p5) 2.40.0
app-misc/pax-utils:        1.3.7::gentoo
app-shells/bash:           5.2_p15-r6::gentoo
dev-lang/perl:             5.38.0::gentoo
dev-lang/python:           3.11.4::gentoo
dev-lang/rust:             1.70.0::gentoo
dev-util/cmake:            3.26.4-r1::gentoo
dev-util/meson:            1.1.1::gentoo
sys-apps/baselayout:       2.14::gentoo
sys-apps/sandbox:          2.36::gentoo
sys-apps/systemd:          253.6::gentoo
sys-devel/autoconf:        2.71-r6::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.40-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.6::gentoo
sys-devel/gcc:             12.3.1_p20230623::gentoo, 13.1.1_p20230527::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             16.0.6::gentoo
sys-devel/llvm:            16.0.6::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.4::gentoo (virtual/os-headers)
sys-libs/glibc:            2.37-r3::gentoo
Repositories:

gentoo
    location: /etc/portage/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: 0
    eclass-overrides: unhappy-ending
    volatile: True

audio-overlay
    location: /etc/portage/repos/audio-overlay
    sync-type: git
    sync-uri: https://github.com/gentoo-audio/audio-overlay.git
    masters: gentoo
    priority: 50
    eclass-overrides: audio-overlay
    volatile: True

brave-overlay
    location: /etc/portage/repos/brave-overlay
    sync-type: git
    sync-uri: https://gitlab.com/jason.oliveira/brave-overlay.git
    masters: gentoo
    priority: 50
    eclass-overrides: brave-overlay
    volatile: True

cg
    location: /etc/portage/repos/cg
    sync-type: git
    sync-uri: https://github.com/brothermechanic/cg
    masters: gentoo
    priority: 50
    eclass-overrides: cg
    volatile: True

guru
    location: /etc/portage/repos/guru
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/repo/proj/guru
    masters: gentoo
    priority: 50
    eclass-overrides: guru
    volatile: True

src_prepare-overlay
    location: /etc/portage/repos/src_prepare-overlay
    sync-type: git
    sync-uri: https://gitlab.com/src_prepare/src_prepare-overlay.git
    masters: gentoo
    priority: 50
    eclass-overrides: src_prepare-overlay
    volatile: True

steam-overlay
    location: /etc/portage/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/anyc/steam-overlay
    masters: gentoo
    priority: 50
    eclass-overrides: steam-overlay
    volatile: True

unhappy-ending
    location: /etc/portage/repos/unhappy-ending
    masters: gentoo
    priority: 100
    eclass-overrides: unhappy-ending
    volatile: True

Installed sets: @desktop-apps, @dev-qt, @kde-frameworks, @kde-plasma, @production-video, @steam-client, @steam-runtime, @system-hardware, @system-kernel, @system-tools, @toolchain-llvm
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="*"
ADDR2LINE="llvm-addr2line"
AR="llvm-ar"
AS="llvm-as"
CBUILD="x86_64-pc-linux-gnu"
CC="clang"
CFLAGS="-march=native -O3 -pipe -fdiagnostics-color=always -frecord-gcc-switches -Wall -Werror=format-security -Werror=implicit-function-declaration -Werror=incompatible-library-redeclaration -Werror=strict-aliasing -Wextra"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/modprobe.d /etc/portage/savedconfig /usr/share/config /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"
CPP="clang-cpp"
CPPFLAGS="-DNDEBUG -U_FORTIFY_SOURCE"
CXX="clang++"
CXXFILT="llvm-cxxfilt"
CXXFLAGS="-march=native -O3 -flto -pipe -fdiagnostics-color=always -frecord-gcc-switches -Wall -Werror=format-security -Werror=incompatible-library-redeclaration -Werror=odr -Werror=strict-aliasing -Wextra"
DISTDIR="/etc/portage/package.distfiles"
EMERGE_DEFAULT_OPTS="-a -j1 --alphabetical --autounmask=n --columns --quiet-build --quiet-unmerge-warn"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE 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 XDG_STATE_HOME"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live candy config-protect-if-modified distlocks ebuild-locks fail-clean fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-log strict test unknown-features-warn unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
GCOV="llvm-cov"
GENTOO_MIRRORS="http://distfiles.gentoo.org /etc/portage/package.mirrors"
LANG="en_US.utf8"
LD="ld.lld"
LDFLAGS="-Wl,--defsym=__gentoo_check_ldflags__=0"
LEX="flex"
LINGUAS="*"
MAKEOPTS="-j16 -l16"
NM="llvm-nm"
OBJCOPY="llvm-objcopy"
OBJDUMP="llvm-objdump"
PKGDIR="/etc/portage/package.distfiles/bin"
PORTAGE_BINHOST="https://calculate.mirror.garr.it/grp/x86_64"
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="/etc/portage/package.tmp"
RANLIB="llvm-ranlib"
READELF="llvm-readelf"
RUSTFLAGS=""
SHELL="/bin/bash"
SIZE="llvm-size"
STRINGS="llvm-strings"
STRIP="llvm-strip"
USE="acl aes amd64 avx avx2 bzip2 cli crypt dri f16c fma3 fortran gdbm iconv ipv6 libtirpc mmx mmxext multilib ncurses nls nptl openmp pam pclmul pcre popcnt rdrand readline seccomp sha split-usr sse sse2 sse3 sse4_1 sse4_2 sse4a ssl ssse3 test test-rust unicode xattr zlib" ABI_X86="32 64" ADA_TARGET="gnat_2021" CALLIGRA_FEATURES="karbon sheets words" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" INPUT_DEVICES="libinput wacom" KERNEL="linux" L10N="*" LLVM_TARGETS="BPF NVPTX X86" LUA_SINGLE_TARGET="lua5-4" LUA_TARGETS="lua5-1" PHP_TARGETS="php8-1" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby32" VIDEO_CARDS="nvidia"
Unset:  ARFLAGS, ASFLAGS, CCLD, CONFIG_SHELL, CTARGET, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GPROF, INSTALL_MASK, LC_ALL, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, YACC, YFLAGS
Comment 6 ppw0 2023-11-24 04:19:58 UTC
I was going to open a new bug until I noticed this one, so let me add my information:

Steps to reproduce:

 1. be in an amd64 environment with clang as the default compiler
 2. emerge app-arch/unzip-6.0_p27-r1 with the -flto switch in CFLAGS/CXXFLAGS
 3. attempt to decompress a zip file

This will cause app-arch/unzip-6.0_p27-r1 to lock with 100% cpu usage.

I'm attaching my emerge --info and a lldb backtrace.
Comment 7 ppw0 2023-11-24 04:20:23 UTC
Created attachment 875455 [details]
emerge --info
Comment 8 ppw0 2023-11-24 04:20:55 UTC
Created attachment 875456 [details]
lldb backtrace
Comment 9 ppw0 2023-11-25 09:21:52 UTC
Created attachment 875605 [details, diff]
unzip-6.0-fix-prototypes.patch

This patch addresses the issue of prototypes, along with some other warnings.