Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 682694 - media-video/ffmpeg-4.1 with sys-devel/gcc-8.3.0-r1 CFLAGS=-ftree-slp-vectorize - deadlock in libavcodec/pngenc.c
Summary: media-video/ffmpeg-4.1 with sys-devel/gcc-8.3.0-r1 CFLAGS=-ftree-slp-vectoriz...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://gcc.gnu.org/PR90006
Whiteboard: Wait for next gcc 7.5/8.4/9.1 release
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-06 16:36 UTC by Linus Lotz
Modified: 2019-05-22 09:16 UTC (History)
1 user (show)

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


Attachments
Preprocessed libavcodec/pngenc.c for testing (pngenc.i,321.22 KB, text/plain)
2019-04-06 16:36 UTC, Linus Lotz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Linus Lotz 2019-04-06 16:36:59 UTC
Created attachment 572098 [details]
Preprocessed libavcodec/pngenc.c for testing

When I try to compile ffmpeg with "-ftee-slp-vectorize" and "-march=zenver1" then gcc is stuck with 100% CPU usage. I've attached the preprocessed file(pngenc.i) which fails (libavcodec/pngenc.c). It can be reproduced using the following minimal command:

x86_64-pc-linux-gnu-gcc -m32 -O2 -march=znver1 -ftree-slp-vectorize -fno-math-errno -c pngenc.i
Comment 1 Linus Lotz 2019-04-06 16:38:04 UTC
emerge --info ffmpeg:
Portage 2.3.62 (python 3.6.5-final-0, default/linux/amd64/17.0/desktop/plasma/systemd, gcc-8.3.0, glibc-2.28-r5, 5.0.5-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.0.5-gentoo-x86_64-AMD_Ryzen_Threadripper_1950X_16-Core_Processor-with-gentoo-2.6
KiB Swap:   67108860 total,  67108860 free
Timestamp of repository gentoo: Sat, 06 Apr 2019 13:45:01 +0000
Head commit of repository gentoo: 51ac82318ed217df5359819237f120aa21edd558
Head commit of repository flatpak-overlay: 9c25d29a61dabb2aa61a61d05f655220807fa7d7

sh bash 4.4_p23-r1
ld GNU ld (Gentoo 2.32 p1) 2.32.0
distcc 3.3.2 x86_64-pc-linux-gnu [disabled]
ccache version 3.3.4 [disabled]
app-shells/bash:          4.4_p23-r1::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.26.2::gentoo
dev-lang/python:          2.7.15::gentoo, 3.6.5::gentoo
dev-util/ccache:          3.3.4-r1::gentoo
dev-util/cmake:           3.9.6::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.13.4-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.32::gentoo
sys-devel/gcc:            8.3.0-r1::gentoo
sys-devel/gcc-config:     2.0::gentoo
sys-devel/libtool:        2.4.6-r5::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.0-r1::gentoo (virtual/os-headers)
sys-libs/glibc:           2.28-r5::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync15.de.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-verify-metamanifest: yes
    sync-rsync-extra-opts: 
    sync-rsync-verify-jobs: 1
    sync-rsync-verify-max-age: 24

local-crossdev
    location: /usr/local/portage
    masters: gentoo
    priority: 0

flatpak-overlay
    location: /usr/local/flatpak-overlay
    sync-type: git
    sync-uri: git://github.com/fosero/flatpak-overlay.git
    masters: gentoo
    priority: 50

maekke
    location: /var/lib/layman/maekke
    sync-type: laymansync
    sync-uri: https://anongit.gentoo.org/git/dev/maekke.git
    masters: gentoo
    priority: 50

sft
    location: /var/lib/layman/sft
    masters: gentoo
    priority: 50

steam-overlay
    location: /var/lib/layman/steam-overlay
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=znver1 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -ftree-vectorize -ftree-slp-vectorize"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /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/php/apache2-php7.2/ext-active/ /etc/php/cgi-php7.2/ext-active/ /etc/php/cli-php7.2/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 -pipe -march=znver1 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -ftree-vectorize -ftree-slp-vectorize"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="-j16 --load-average=32.0 --keep-going=y"
ENV_UNSET="DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN 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 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs config-protect-if-modified distlocks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=znver1 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512 -ftree-vectorize -ftree-slp-vectorize"
GENTOO_MIRRORS="http://ftp.halifax.rwth-aachen.de/gentoo/ http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/ http://mirror.eu.oneandone.net/linux/distributions/gentoo/gentoo/"
LANG="de_DE.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de de_DE en en_US en_GB"
MAKEOPTS="-j16"
PKGDIR="/usr/portage/packages"
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 aacs acl acoustid acpi activities aec aes aes-ccm aes-gcm aes-ni aio alsa amd64 aqbanking argyllcms avahi bdplus bluray branding bzip2 cairo cdda cdio cdparanoia cdr celt chipcard chromaprint clang colord conntrack crypt cryptsetup cups cxx d3d9 dbus declarative dhcp-tools dnssec dolphin dri3 dts dvd dvdr ebics efi egl emboss encode exif fam ffmpeg fits flac fortran gif glamor gles gles1 gles2 gmp gmp-autoupdate gnuefi gold gpm gtk haptic hardened hbci http2 hugepages hvm iconv icu idn indi int64 ipv6 jit jpeg kde kipi kwallet lcms ldap libinput libkms libnotify libsamplerate libtirpc lm_sensors luajittex luatex mad mng mp3 mp4 mpeg mtp multilib ncurses networkmanager nfs nfsv4 nfsv41 nine nls no-distcc nptl offensive ofx ogg opencl openexr opengl openmp opus ovmf pam pango pcre pdf pgplot phonon pie plasma plymouth png policykit ppds printsupport pulseaudio python qml qt5 raw readline realtime s3tc samba sddm sdl seccomp semantic-desktop sound sox soxr speex spell spice sse sse2 sse3 sse4 sse4_1 sse4_2 ssl ssp startup-notification steamfonts svg systemd telepathy threads tiff trayicon truetype tslib twolame udev udf udisks unicode upower usb vaapi vdpau vorbis vulkan wayland wcs webrtc-aec widevine widgets wxwidgets x264 xattr xcb xcomposite xetex xinerama xml xplanet xscreensaver xtpax xv xvid xvmc zeroconf zlib zsh-completion" ABI_X86="64 32" 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" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" CURL_SSL="openssl" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="roccat_konepureoptical roccat_konepuremilitary roccat_ryosmk roccat_ryosmkfx roccat_konextd roccat_konepure roccat_koneplus joystick libinput keyboard mouse wacom" KERNEL="linux" L10N="de de-DE en en-US en-GB" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LLVM_TARGETS="X86 ARM AArch64 AMDGPU" NETBEANS_MODULES="apisupport cnd groovy gsf harness ide identity j2ee java mobility nb php profiler soa visualweb webcommon websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-1" POSTGRES_TARGETS="postgres9_5 postgres10" PYTHON_SINGLE_TARGET="python3_6" PYTHON_TARGETS="python2_7 python3_6" QEMU_SOFTMMU_TARGETS="x86_64 arm aarch64" QEMU_USER_TARGETS="x86_64 arm aarch64" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="radeon r600 amdgpu radeonsi" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq 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

=================================================================
                        Package Settings
=================================================================

media-video/ffmpeg-4.1::gentoo was built with the following:
USE="X alsa bluray bzip2 cdio chromaprint encode gmp gpl hardcoded-tables iconv librtmp mp3 network opencl opengl openssl opus postproc pulseaudio samba sdl speex svg threads truetype twolame vaapi vdpau vorbis x264 xcb xvid zlib (-altivec) -amr -amrenc (-appkit) -bs2b -chromium -codec2 -cpudetection -debug -doc -fdk -flite -fontconfig -frei0r -fribidi -gcrypt -gme -gnutls -gsm -iec61883 -ieee1394 -jack -jpeg2k -kvazaar -ladspa -libaom -libass -libcaca -libdrm -libilbc -libressl -libsoxr -libv4l -lv2 -lzma (-mipsdspr1) (-mipsdspr2) (-mipsfpu) (-mmal) -modplug -openal -openh264 -oss -pic -rubberband -snappy -srt -ssh -static-libs -test -theora -v4l -vpx -wavpack -webp -x265 -zeromq -zimg -zvbi" ABI_X86="32 (64) (-x32)" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext sse sse2 sse3 sse4_1 sse4_2 ssse3 -3dnow -3dnowext -fma4 -xop" FFTOOLS="aviocat cws2fws ffescape ffeval ffhash fourcc2pixfmt graph2dot ismindex pktdumper qt-faststart sidxindex trasher" VIDEO_CARDS="-nvidia"
CFLAGS="-O2 -pipe -march=znver1 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512"
CXXFLAGS="-O2 -pipe -march=znver1 --param=l1-cache-size=32 --param=l1-cache-line-size=64 --param=l2-cache-size=512"
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2019-04-08 07:00:54 UTC
Confirmed locally. Let's see if I can reduce it something nicer for gcc upstream to look at.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2019-04-08 07:02:40 UTC
Meanwhile 'perf' says looping happens in:
    97,74%  cc1              cc1                      [.] vect_get_constant_vectors
Comment 4 Sergei Trofimovich (RETIRED) gentoo-dev 2019-04-08 08:41:55 UTC
creduce generated that:

// Now to reproduce:
// $ /usr/bin/x86_64-pc-linux-gnu-gcc -m32 -O2 -ftree-slp-vectorize -fno-math-errno -c bug.c -o bug.o -Wall

long int lrint(double x);

int a, b;
union c {
  int d;
};

int e() {
  int f, g, h;
  long i, j, k;
  double l, m = b = lrint(0.3127);
  a = b >> 16 >> 8 & 255;
  ((union c *)e)->d = a;
  k = m;
  h = k >> 16 >> 8 & 255;
  ((union c *)(e + 4))->d = h;
  j = lrint(l);
  g = j >> 16 >> 8 & 255;
  ((union c *)(e + 8))->d = g;
  i = lrint(0.292);
  f = i >> 16 >> 8 & 255;
  ((union c *)(e + 12))->d = f;
  return 0;
}
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2019-04-08 08:55:12 UTC
Reported upstream as https://gcc.gnu.org/PR90006
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2019-04-27 08:41:19 UTC
The fix is in gcc's main tree.  I'm a bit afraid of backporting the change on gentoo side.

We will wait for next gcc releases in 7.5/8.4/9.1 branches to grab a fix for it.
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2019-05-22 09:16:12 UTC
gcc-9.1.0 is in gentoo.