Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 640014 - sys-libs/db-6.0.35 with sys-devel/gcc-7.2.0 with graphite and lto - .../work/db-6.0.35/src/dbreg/dbreg_util.c:27:1: internal compiler error: Segmentation fault
Summary: sys-libs/db-6.0.35 with sys-devel/gcc-7.2.0 with graphite and lto - .../work/...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
Depends on:
Reported: 2017-12-06 12:02 UTC by Amit Prakash Ambasta
Modified: 2021-01-20 08:44 UTC (History)
1 user (show)

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

I've isolated the command that fails and added verbosity for detail in the attachment (offending_compile,58.82 KB, text/plain)
2017-12-06 12:02 UTC, Amit Prakash Ambasta
build.log (build.log,376.92 KB, text/x-log)
2017-12-06 12:24 UTC, Amit Prakash Ambasta

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Prakash Ambasta 2017-12-06 12:02:00 UTC
Created attachment 508464 [details]
I've isolated the command that fails and added verbosity for detail in the attachment

Since the profile upgrade to 17.0, lots of packages fail on graphite + lto (which had compiled successfully before).. One such package is sys-libs/db
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2017-12-06 12:16:46 UTC
Please attach the entire build log to this bug report.
Please post your `emerge --info` output in a comment.
Comment 2 Amit Prakash Ambasta 2017-12-06 12:19:53 UTC
 Your comment was:

    I've isolated the segfault to this function in src/dbreg/dbreg_util.c

     * __dbreg_add_dbentry --
     *  Adds a DB entry to the dbreg DB entry table.
     * PUBLIC: int __dbreg_add_dbentry __P((ENV *, DB_LOG *, DB *, int32_t));
    __dbreg_add_dbentry(env, dblp, dbp, ndx)
        ENV *env;
        DB_LOG *dblp;
        DB *dbp;
        int32_t ndx;
        int32_t i;
        int ret;

        ret = 0;

        MUTEX_LOCK(env, dblp->mtx_dbreg);

         * Check if we need to grow the table.  Note, ndx is 0-based (the
         * index into the DB entry table) an dbentry_cnt is 1-based, the
         * number of available slots.
        if (dblp->dbentry_cnt <= ndx) {
            if ((ret = __os_realloc(env,
                (size_t)(ndx + DB_GROW_SIZE) * sizeof(DB_ENTRY),
                &dblp->dbentry)) != 0)
                goto err;

            /* Initialize the new entries. */
            for (i = dblp->dbentry_cnt; i < ndx + DB_GROW_SIZE; i++) {
                dblp->dbentry[i].dbp = NULL;
                dblp->dbentry[i].deleted = 0;
            dblp->dbentry_cnt = i;

        DB_ASSERT(env, dblp->dbentry[ndx].dbp == NULL);
        dblp->dbentry[ndx].deleted = dbp == NULL;
        dblp->dbentry[ndx].dbp = dbp;

    err:    MUTEX_UNLOCK(env, dblp->mtx_dbreg);
        return (ret);
Comment 3 Amit Prakash Ambasta 2017-12-06 12:20:25 UTC
emerge --info

Portage 2.3.16 (python 3.6.3-final-0, default/linux/amd64/17.0/no-multilib, gcc-7.2.0, glibc-2.26-r3, 4.14.2-gentoo x86_64)
System uname: Linux-4.14.2-gentoo-x86_64-Intel-R-_Core-TM-_i5-4210U_CPU_@_1.70GHz-with-gentoo-2.4.1
KiB Mem:    16334380 total,   4346952 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Tue, 05 Dec 2017 09:12:43 +0000
Head commit of repository gentoo: 5481daa220c139e9eb1417650645d74836676ea2

Timestamp of repository sublime-text: Thu, 30 Nov 2017 20:52:27 +0000
Head commit of repository sublime-text: 601e7968147be3189b39c34a55d952d189d2f0e5

sh bash 4.4_p12
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.26.1-r1::gentoo
dev-lang/python:          2.7.14-r1::ambasta, 3.5.4-r1::ambasta, 3.6.3-r1::ambasta
dev-util/cmake:           3.10.0::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/sandbox:         2.12::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo
sys-devel/gcc:            7.2.0::gentoo
sys-devel/gcc-config:     1.9.0-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r3::gentoo

    location: /usr/portage
    sync-type: git
    priority: -1000

    location: /var/lib/layman/ambasta
    masters: gentoo

    location: /var/lib/layman/delhivery
    masters: gentoo

    location: /var/db/repos/sublime-text
    sync-type: git
    masters: gentoo

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA google-chrome Sublime Google-TOS PUEL"
CFLAGS="-O2 -pipe -march=haswell -ftree-vectorize -flto=5 -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/chromium/policies/managed/chrome-gnome-shell.json /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/opt/chrome/policies/managed/chrome-gnome-shell.json /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -pipe -march=haswell -ftree-vectorize -flto=5 -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news nodoc noinfo nostrip parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-O2 -pipe -march=haswell -ftree-vectorize -flto=5 -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block -fuse-linker-plugin"
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"
USE="X acl amd64 berkdb bzip2 cleartype_hinting cli cracklib crypt cups cxx dbus dri dri3 foomaticdb fuse gdbm glamor gnome gnome-keyring graphite gtk3 iconv introspection lcms libkms lz4 lzma modules ncurses networkmanager nls nptl opencl opengl openmp pam pcre pgo policykit ppds pulseaudio python3 readline seccomp session ssl systemd tcpd udev unicode vulkan wayland xattr zlib" ABI_X86="64" ALSA_CARDS="hda-intel" 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="kexi words flow plan sheets stage tables krita karbon braindump author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" 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="pc" INPUT_DEVICES="libinput" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en_US" LLVM_TARGETS="X86" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5 python3_6" RUBY_TARGETS="ruby24" USERLAND="GNU" VIDEO_CARDS="intel i965 fbdev" 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"
Comment 4 Amit Prakash Ambasta 2017-12-06 12:24:17 UTC
Created attachment 508468 [details]
Comment 5 Amit Prakash Ambasta 2017-12-06 12:30:35 UTC
Further verified that only line 54 in dbreg_util.c is the one leading to segfault.

> dblp->dbentry[i].deleted = 0;
Comment 6 Amit Prakash Ambasta 2017-12-06 12:36:39 UTC
Finally isolated the CXXFLAGS that cause the segfault to -ftree-loop-distribution and -flto=5

Removing either flto or ftree-loop-distribution or the statement resolves the segfault. Upstream bug perhaps?
Comment 7 Sergei Trofimovich gentoo-dev 2021-01-20 08:44:22 UTC
Does it still happen for you on current toolchains and dependencies? I tried gcc-7.5.0 with your CFLAGS/CXXFLAGS/LDFLAGS and did not get a build crash.