Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 649880 - sys-devel/llvm-6.0.0_rc3 hangs during x86_32 build with CFLAGS containing "-O2"
Summary: sys-devel/llvm-6.0.0_rc3 hangs during x86_32 build with CFLAGS containing "-O2"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: LLVM support project
URL:
Whiteboard:
Keywords:
: 650110 (view as bug list)
Depends on:
Blocks: gcc-7
  Show dependency tree
 
Reported: 2018-03-08 00:04 UTC by Konstantin M
Modified: 2018-03-12 16:09 UTC (History)
18 users (show)

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


Attachments
output of emerge --info (emerge--info.txt,5.98 KB, text/plain)
2018-03-08 00:04 UTC, Konstantin M
Details
build.log.gz (build.log.gz,38.56 KB, application/gzip)
2018-03-08 00:08 UTC, Konstantin M
Details
output of "gcc -### -march=native -x c -" (gcc-flag.txt,4.25 KB, text/plain)
2018-03-10 06:59 UTC, Christoph Loehr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin M 2018-03-08 00:04:04 UTC
Created attachment 522910 [details]
output of emerge --info

For quite some time I'm unable to emerge llvm. The build hangs during the 32bit part of a multilib enabled emerge. It uses up all available CPU cores (-j setting in MAKEOPTS). It looks much like an infinite loop - I let it run for hours on multiple occasions.

Currently affected are probably all versions greater than llvm-5.0.1. I specifically tested llvm-9999 and various versions of llvm:6. The logs in this bug report are from llvm-6.0.0_rc3.


With MAKEOPTS="-j1" the last output on the console running emerge is:
[1075/1754] cd /var/tmp/portage/sys-devel/llvm-6.0.0_rc3/work/llvm-6.0.0rc3.src-abi_x86_32.x86/lib/Target/X86 && /usr/bin/cmake -E copy_if_different /var/tmp/portage/sys-devel/llvm-6.0.0_rc3/work/llvm-6.0.0rc3.src-abi_x86_32.x86/lib/Target/X86/X86GenDisassemblerTables.inc.tmp /var/tmp/portage/sys-devel/llvm-6.0.0_rc3/work/llvm-6.0.0rc3.src-abi_x86_32.x86/lib/Target/X86/X86GenDisassemblerTables.inc


And this is how I emerge llvm and its initial output:
MAKEOPTS="-j1" emerge -v1a =llvm-6.0.0_rc3
[ebuild  NS   *] sys-devel/llvm-6.0.0_rc3:6::gentoo [5.0.1:5::gentoo] USE="libffi ncurses xml -debug -doc -gold -libedit {-test} -xar" ABI_X86="32 (64) (-x32)" LLVM_TARGETS="AMDGPU BPF NVPTX (X86) -AArch64 -ARM -Hexagon -Lanai -MSP430 -Mips -PowerPC -Sparc -SystemZ -XCore" 24,703 KiB


Steps to reproduce:
1. emerge llvm > 5 on a 64bit system with ABI_X86=32 enabled

Reproducible: always

If I can provide any other helpful information, please let me know.
Comment 1 Konstantin M 2018-03-08 00:08:35 UTC
Created attachment 522912 [details]
build.log.gz
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-03-09 07:22:07 UTC
It's the first time I hear of such a problem. You don't seem to be using anything extraordinary, though. Could you try building with USE=-abi_x86_32 (you can use -B to avoid installing it)? That would help us determine if the deadlock is specific to 32-bit build or if it happens to 64-bit build as well.
Comment 3 Konstantin M 2018-03-09 16:16:54 UTC
Thanks for looking into this, Michał!
I just compiled the 64bit llvm as you suggested - successfully.

Command line:
USE="$USE -abi_x86_32" emerge -v1a -B =llvm-6.0.0_rc3
[ebuild  NS   *] sys-devel/llvm-6.0.0_rc3:6::gentoo [5.0.1:5::gentoo] USE="libffi ncurses xml -debug -doc -gold -libedit {-test} -xar" ABI_X86="(64) -32 (-x32)" LLVM_TARGETS="AMDGPU BPF NVPTX (X86) -AArch64 -ARM -Hexagon -Lanai -MSP430 -Mips -PowerPC -Sparc -SystemZ -XCore" 0 KiB

I'm having this problem (with llvm-9999) for some months now. I also tried to find any indication of similar problems on the web, but to no avail. Please tell me if I can test anything else or you need more information.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-03-09 16:20:56 UTC
To be honest, I have no clue what could be wrong. It could be somewhat CPU-related -- you may try different -march= but even if you have any results, I doubt I will be able to help you.
Comment 5 Konstantin M 2018-03-09 21:32:00 UTC
Well, you already helped me :-) I got it to compile successfully. The culprit really is in the CFLAGS, but it's not the -march=native. It's the -O2. If I go back to -O1 it works (I also re-verified that just changing it to -O2 fails again).

Shall I close this bug report or do you want to dig deeper?
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-03-09 22:25:02 UTC
'-O2' is quite a big hammer, and this doesn't guarantee it's the only possible cause. It may be some optimization that affects specific -O + -march combination, for example.

Ok, could you do two things for me:

1. Convert '-march=native' into regular flags (see [1]) and see if it still happens.

2. Check (e.g. via htop) which command is hanging.

If I'm able to reproduce it locally, I wouldn't have to bother you much more ;-).

[1]:https://blogs.gentoo.org/mgorny/2014/06/23/inlining-marchnative-for-distcc/
Comment 7 Jan-Matthias Braun 2018-03-09 23:17:47 UTC
Hi!

I can confirm to have the same problem. I will try to come up with more information, i.e., variations in CFLAGS.
Comment 8 Ryan El Kochta 2018-03-10 01:12:09 UTC
i5-6500, -march=native, ~amd64 system, and -O2 set in make.conf

I am also affected by this bug.
Comment 9 Kenton Groombridge 2018-03-10 03:37:45 UTC
Not to just post the typical "me too" comment, but llvm-6.0.0 was just added to Gentoo testing which I am running. I have two systems affected by this bug each with different flavors of Intel processors. I have confirmed that using -O1 allows llvm-6.0.0 to build on them.

I want to add any info to help out and though I would start with the processors of the affected systems:

Intel(R) Core(TM) i7-6800K CPU @ 3.40GHz
Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz

This system built fine with -O2

Intel(R) Core(TM) i3 CPU       M 370  @ 2.40GHz
Comment 10 Christoph Loehr 2018-03-10 06:59:14 UTC
Created attachment 523208 [details]
output of "gcc -### -march=native -x c -"

Same issue here with sys-devel/llvm-6.0.0

Processor: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz on a Lenovo L570

Changing the CFLAGS from "-march=native -mtune=native -O2 -pipe -Wall" to "-march=native -mtune=native -O1 -pipe -Wall" helped.

Moreover, I attach the output of "gcc -### -march=native -x c -".

Please let me know, if I could provide any help or further information.
Comment 11 Christoph Loehr 2018-03-10 07:27:14 UTC
Some more info. This is the last line of the emerge output where the build starts to hang:

[1094/1525] cd /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src-abi_x86_32.x86 && /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src-abi_x86_32.x86/bin/llvm-tblgen -gen-register-bank -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target/X86 -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/include -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target/X86/X86.td -o lib/Target/X86/X86GenRegisterBank.inc.tmp -d lib/Target/X86/X86GenRegisterBank.inc.d
Comment 12 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-03-10 07:41:44 UTC
Build log is not useful because ninja guys (thanks, Google!) decided to output commands *after* they are executed. So if a command hangs, it never gets output and you gotta look via htop.

Also, gcc versions would be useful. Because this looks like gcc bug.
Comment 13 Juergen Rose 2018-03-10 08:23:13 UTC
I have the same issue with the following system:

root@lynx:/root(55)# gcc-config -l
 [1] x86_64-pc-linux-gnu-7.3.0 *

root@lynx:/root(56)# uname -a
Linux lynx 4.15.7-gentoo-r1 #1 SMP Fri Mar 2 07:29:13 CET 2018 x86_64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz GenuineIntel GNU/Linux

root@lynx:/root(57)# emerge --info =llvm-6.0.0
Portage 2.3.24 (python 3.5.4-final-0, default/linux/amd64/17.0/desktop, gcc-7.3.0, glibc-2.26-r6, 4.15.7-gentoo-r1 x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-4.15.7-gentoo-r1-x86_64-Intel-R-_Core-TM-_i7-6700HQ_CPU_@_2.60GHz-with-gentoo-2.4.1
KiB Mem:    15905612 total,   4157036 free
KiB Swap:   50331644 total,  49172064 free
Timestamp of repository gentoo: Sat, 10 Mar 2018 07:00:01 +0000
Head commit of repository gentoo: bcf7f545088c9f75ab84e479ce095a8564f884bb
sh bash 4.4_p19
ld GNU ld (Gentoo 2.30 p1) 2.30.0
distcc[30735] (dcc_trace_version) distcc 3.2rc1 x86_64-pc-linux-gnu; built Dec 29 2017 18:12:02 [disabled]
app-shells/bash:          4.4_p19::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.26.1-r2::gentoo
dev-lang/python:          2.7.14-r101::sage-on-gentoo, 3.4.6-r1::gentoo, 3.5.4-r1::gentoo, 3.6.4::gentoo
dev-util/cmake:           3.10.2::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.9.6-r5::gentoo, 1.11.6-r3::gentoo, 1.16-r1::gentoo
sys-devel/binutils:       2.30::gentoo
sys-devel/gcc:            7.3.0::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r2::gentoo
sys-kernel/linux-headers: 4.15::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r6::gentoo
Repositories:

gentoo
    location: /usr/portage_lynx
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: no

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

g-cpan
    location: /var/lib/cpan
    masters: gentoo
    priority: 1

g-octave
    location: /var/lib/g-octave
    masters: gentoo
    priority: 2

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

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

sage-on-gentoo
    location: /var/lib/layman/sage-on-gentoo
    masters: gentoo science
    priority: 50

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

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

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

Installed sets: @system
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA PUEL Intel-SDP dlj-1.1 skype-eula skype-4.0.0.7-copyright googleearth AdobeFlash-11.x cadsoft Oracle-BCLA-JavaSE MakeMKV-EULA NVIDIA-CUDA Nero-AAC-EULA GIMPS"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=broadwell -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /etc/stunnel/stunnel.conf /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="-march=broadwell -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs clean-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=broadwell -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="de en fr ru"
MAKEOPTS="-j9"
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="64bit R X Xaw3d a52 aac acl acpi admin afs alsa amd64 amr ao apache2 apng applet archive armadillo arpack asf aspell assistant atlas audiofile aufs automap automount barcode bash-completion berkdb blas blast bluetooth bluray boost branding btrfs bzip2 cairo cdda cddb cdf cdio cdparanoia cdr cg cgi chm cilk clang cli cmake collada consolekit contrib crypt css cups curl cxx daap db dbi dbm dbus declarative designer devhelp device-mapper dga dia digitalradio djvu doc dot dri ds2490 ds9097 ds9097u dts dv dvb dvd dvdr dvi dynamicplugin eds egl elf emacs emboss emf encode epiphany evdev evo examples excel exif expat extensions extra extras faac faad fam ffmpeg fftw firefox fits flac fltk fontconfig foomaticdb fortran fortran95 fpm fpx ftp fuse gcj gd gdal gdbm gedit geoip geolocation geos gfortran gif gimp git glade glamor glib glpk gml gmp gnome gnome-keyring gnuplot gnutls gold gphoto2 gpm grammar graphics graphtft graphviz grass gsl gsm gstreamer gtk gtk3 gudev guile hdaps hddtemp hdf hdf5 hdri html http httpd hvm hwdb iconv icq icu id3tag ide imagemagick imap inotify introspection ipod ipv6 irda ithreads jadetex java jbig jit john jpeg jpeg2k kate kde kdepim kdrive kerberos keymap kpathsea kvm ladspa lame lapack latex lcms ldap lensfun libffi libgda libkms libnotify libsamplerate live lm_sensors lua lzma lzo mad mail maildir mapnik math matroska media-library mercurial mikmod mkl mng mod modules mono motif mozilla mp3 mp4 mpeg mpi mpi-threads mplayer mtp multilib multimedia musepack musicbrainz mysql mysqli nautilus ncurses neXt netcdf netpbm network networking nfs nls nntp nptl nsplugin ntfs ntp numpy obex objc ocaml ocr octave odbc ofa ogdi ogg opencl opencv openexr opengl openmp openvg pam pango pcre pda pdf pdl2 perl plasma plotutils plugins png podcast policykit portaudio posix postgres postscript ppds ppp preview-latex proj projectm pstricks pulseaudio python q16 q32 qemu qhull qml qt3support qt5 quicktime raw readline reiserfs reports rle romio rpc rrdcgi rrdtool rtlsdr sage samba sasl schroedinger science sdk sdl seccomp secure-delete server session shout sip slang slp smart smbclient smp sms sndfile snmp soap sockets sound soup sox speex spell sql sqlite ssl startup-notification stlport subtitles subversion sudo suexec svg svm swig systemd szip t1lib tbb tcl tcpd tex tex4ht theora thesaurus thinkpad threads thunderbird tidy tiff tk tools truetype udev udisks unicode upower usb utempter v4l v4l2 vaapi vala valgrind vdpau video vim-syntax virt-network virtualbox visio vorbis vpx vtk wav wayland webdav webdav-serf webkit wifi wmf wxwidgets x264 xa xattr xcb xen xetex xft xine xml xmlreader xmlrpc xpm xv xvid xvmc yaml youtube zlib zsh-completion zvbi" ABI_X86="64" ALSA_CARDS="intel8x0" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_core authn_dbm authn_default authn_file authz_core authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgid dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info lbmethod_byrequests log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif slotmem_shm so socache_shmcb speling status unique_id unixd userdir usertrack vhost_alias" APACHE2_MPMS="worker" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="canon fuji ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog sensors thermal" CPU_FLAGS_X86="aes avx avx2 fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" CURL_SSL="nss" ELIBC="glibc" GPSD_PROTOCOLS="aivdm ashtech earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 navcom ntrip oceanserver oncore rtcm104v2 rtcm104v3 sirf superstar2 tnt tripmate tsip ublox nmea0183 nmea2000 passthrough" GRUB_PLATFORMS="emu efi-64 pc xen" INPUT_DEVICES="keyboard mouse evdev synaptics void" KERNEL="linux" L10N="de en fr ru" LCD_DEVICES="cfontz hd44780 mtxorb ncurses X lcd2usb lcdlinux png usblcd SureElec" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LIRC_DEVICES="devinput" NETBEANS_MODULES="apisupport cnd dlight enterprise ergonomics groovy gsf harness ide identity j2ee java mobility nb php profiler websvccommon xml" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby22 ruby23" USERLAND="GNU" VIDEO_CARDS="nouveau intel i965 displaylink" 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, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 14 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-03-10 10:44:33 UTC
Ok. Did anyone hit this with gcc-6? If not, we can put gcc-7 as the first cause.
Comment 15 jannis 2018-03-10 11:03:03 UTC
Same for me on two machines, both running gcc-7.3.0. Commands being executed according to top:

kripton@momo ~ $ ps axuwww | grep -i tbl
kripton   2967  0.0  0.0  13596   952 pts/6    S+   12:02   0:00 grep --colour=auto -i tbl
portage  32349 96.2  0.7 117032 111432 pts/1   RN   10:00 116:33 /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src-abi_x86_32.x86/bin/llvm-tblgen -gen-instr-info -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target/X86 -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/include -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target/X86/X86.td -o lib/Target/X86/X86GenInstrInfo.inc.tmp -d lib/Target/X86/X86GenInstrInfo.inc.d
portage  32363 96.3  0.6 117032 111088 pts/1   RN   10:01 116:38 /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src-abi_x86_32.x86/bin/llvm-tblgen -gen-dag-isel -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target/X86 -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/include -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target/X86/X86.td -o lib/Target/X86/X86GenDAGISel.inc.tmp -d lib/Target/X86/X86GenDAGISel.inc.d
portage  32365 96.2  0.7 117032 111296 pts/1   RN   10:01 116:27 /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src-abi_x86_32.x86/bin/llvm-tblgen -gen-fast-isel -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target/X86 -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/include -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target/X86/X86.td -o lib/Target/X86/X86GenFastISel.inc.tmp -d lib/Target/X86/X86GenFastISel.inc.d
portage  32387 96.2  0.7 117032 111236 pts/1   RN   10:01 115:54 /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src-abi_x86_32.x86/bin/llvm-tblgen -gen-global-isel -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target/X86 -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/include -I /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target /var/tmp/portage/sys-devel/llvm-6.0.0/work/llvm-6.0.0.src/lib/Target/X86/X86.td -o lib/Target/X86/X86GenGlobalISel.inc.tmp -d lib/Target/X86/X86GenGlobalISel.inc.d

All commands have been running for about 2 hours
Comment 16 brot 2018-03-10 11:46:17 UTC
Hello everyone. I can confirm that behaviour, too.

Here is the first line of emerge --info:

Portage 2.3.24 (python 3.5.4-final-0, default/linux/amd64/17.0/desktop/plasma/systemd, gcc-7.3.0, glibc-2.26-r6, 4.15.7 x86_64)

Looks like this might indeed be a problem with gcc-7.3.0. My CFLAGS are quite boring too: CFLAGS="-O2 -march=native -pipe"

I am currently emerging an older gcc and will try to rebuild llvm with gcc < 7.0

Thanks for your help,
Michael
Comment 17 jannis 2018-03-10 11:58:47 UTC
Indeed, with gcc-6.4.0-r1, llvm-6.0.0 emerged fine on a system where it stalled before (so nothing else other than the verison of gcc changed)
Comment 18 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-03-10 12:55:01 UTC
@toolchain, any known GCC-7 bugs that could cause this?
Comment 19 Larry the Git Cow gentoo-dev 2018-03-10 14:05:53 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43ba0dabac8afb4fc205e5282f3eb42935408854

commit 43ba0dabac8afb4fc205e5282f3eb42935408854
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2018-03-10 14:04:52 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-03-10 14:05:46 +0000

    sys-devel/llvm: Temporarily refuse to build w/ GCC-7 due to hangs
    
    Bug: https://bugs.gentoo.org/649880

 sys-devel/llvm/llvm-6.0.0.ebuild | 9 +++++++++
 1 file changed, 9 insertions(+)}
Comment 20 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-03-10 14:08:25 UTC
To anyone who wants to help, I think the next step would be to try if it happens with lower '-march' values (e.g. -march=x86_64) and possibly playing with various -f flags that are normally implied by -O2. I'm sorry but I don't know how to do that exactly with GCC, I've been only reducing such issues with clang.
Comment 21 Ryan El Kochta 2018-03-10 15:46:12 UTC
I would just like to point out that LLVM is really only used at compile-time, and by setting -O1 you're really only increasing build times of packages that use LLVM by a tad bit (mainly Mesa). So you can just set -O1 until the bug is fixed.
Comment 22 Alexander Tsoy 2018-03-10 17:59:15 UTC
I can't reproduce this bug with -march=dbver2 and -march=core2.

(In reply to Ryan El Kochta from comment #21)
> I would just like to point out that LLVM is really only used at
> compile-time

This is not true. For example AMDGPU target is used at run time.
Comment 23 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-03-10 17:59:57 UTC
*** Bug 650110 has been marked as a duplicate of this bug. ***
Comment 24 Alexander Bezrukov 2018-03-10 20:30:29 UTC
This seems to be upstream bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81763
Comment 25 Alexander Bezrukov 2018-03-10 20:33:28 UTC
(In reply to Larry the Git Cow from comment #19)
> The bug has been referenced in the following commit(s):
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=43ba0dabac8afb4fc205e5282f3eb42935408854
> 
> commit 43ba0dabac8afb4fc205e5282f3eb42935408854
> Author:     Michał Górny <mgorny@gentoo.org>
> AuthorDate: 2018-03-10 14:04:52 +0000
> Commit:     Michał Górny <mgorny@gentoo.org>
> CommitDate: 2018-03-10 14:05:46 +0000
> 
>     sys-devel/llvm: Temporarily refuse to build w/ GCC-7 due to hangs
>     
>     Bug: https://bugs.gentoo.org/649880
> 
>  sys-devel/llvm/llvm-6.0.0.ebuild | 9 +++++++++
>  1 file changed, 9 insertions(+)}

I should be sufficient to add -mno-bmi to compiler flags.
There is also a patch available upstream.
Comment 26 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2018-03-10 20:40:33 UTC
Thanks a lot. I'll update the ebuild hack now.
Comment 27 Larry the Git Cow gentoo-dev 2018-03-10 20:48:41 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=deda94ea9dfc8e43ece0a6bd7190ba67147ec08e

commit deda94ea9dfc8e43ece0a6bd7190ba67147ec08e
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2018-03-10 20:48:02 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2018-03-10 20:48:34 +0000

    sys-devel/llvm: Apply -mno-bmi to work-around gcc-7 bug
    
    Thanks to Alexander Bezrukov for finding the upstream bug and suggesting
    a proper workaround.
    
    Closes: https://bugs.gentoo.org/649880

 sys-devel/llvm/llvm-6.0.0.ebuild    | 16 +++++++---------
 sys-devel/llvm/llvm-6.0.9999.ebuild |  7 +++++++
 sys-devel/llvm/llvm-9999.ebuild     |  7 +++++++
 3 files changed, 21 insertions(+), 9 deletions(-)
Comment 28 Larry the Git Cow gentoo-dev 2018-03-11 10:03:07 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7b06fb722b73f8e8c09a906d8f921f9975955a94

commit 7b06fb722b73f8e8c09a906d8f921f9975955a94
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2018-03-11 10:02:41 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2018-03-11 10:03:01 +0000

    sys-devel/gcc: bump 1.1 patchset: add i386-bmi tweak, bug #649880
    
    Single new patch:
    + 91_all_bmi-i386-PR-target-81763.patch
    
    No keywords yet to verify minmal sanity.
    
    Bug: https://bugs.gentoo.org/649880
    Bug: https://gcc.gnu.org/PR81763
    Package-Manager: Portage-2.3.24, Repoman-2.3.6

 sys-devel/gcc/Manifest            |  1 +
 sys-devel/gcc/gcc-7.3.0-r1.ebuild | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)}
Comment 29 Mike Lothian 2018-03-12 16:09:37 UTC
This is a duplicate of https://bugs.gentoo.org/645776