Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via or IRC

Bug 619378

Summary: media-libs/coin-3.1.3-r2 with gcc-6.3.0 segfaults in SoDB::init()
Product: Gentoo Linux Reporter: eroen <gentoo>
Component: Current packagesAssignee: Maciej Mrozowski <reavertm>
Severity: normal CC: jstein, junk4me46806, plevine457
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 582084    
Attachments: coin-3.1.3-gcc-6.patch

Description eroen 2017-05-22 17:17:30 UTC
The below test program works fine when media-libs/coin is built with gcc-5.4.0-r3.

eroen@occam ~/cointest $ cat main.cpp 
#include <Inventor/SoDB.h>

int main()
	return 0;
eroen@occam ~/cointest $ g++ $(pkg-config --cflags Coin) -o main.o -c main.cpp
eroen@occam ~/cointest $ g++ $(pkg-config --cflags Coin) $(pkg-config --libs Coin) -o main main.o
eroen@occam ~/cointest $ ./main
Segmentation fault (core dumped)
eroen@occam ~/cointest $ gdb -q -c core main
Reading symbols from main...done.
[New LWP 757362]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/".
Core was generated by `./main'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  cc_memalloc_deallocate (allocator=0x0, ptr=ptr@entry=0x6679e4170) at /usr/src/debug/media-libs/coin-3.1.3-r2/Coin-3.1.3/src/base/memalloc.cpp:186
186	  allocator->num_allocated_units--;
(gdb) bt full
#0  cc_memalloc_deallocate (allocator=0x0, ptr=ptr@entry=0x6679e4170) at /usr/src/debug/media-libs/coin-3.1.3-r2/Coin-3.1.3/src/base/memalloc.cpp:186
        newfree = 0x6679e4170
#1  0x000003a818d57d06 in SbHashEntry<short, char const*>::operator delete (ptr=0x6679e4170) at /usr/src/debug/media-libs/coin-3.1.3-r2/Coin-3.1.3/src/misc/SbHash.h:89
        entry = 0x6679e4170
#2  SbHash<short, char const*>::resize (newsize=<optimized out>, this=0x6679cf1f0) at /usr/src/debug/media-libs/coin-3.1.3-r2/Coin-3.1.3/src/misc/SbHash.h:322
        preventry = 0x6679e4170
        entry = 0x0
        oldsize = 257
        oldbuckets = 0x6679cf250
        i = 0
#3  SbHash<short, char const*>::put (obj=<optimized out>, key=<optimized out>, this=0x6679cf1f0) at /usr/src/debug/media-libs/coin-3.1.3-r2/Coin-3.1.3/src/misc/SbHash.h:226
        i = <optimized out>
        entry = <optimized out>
#4  SoType::createType (parent=..., name=..., method=method@entry=0x3a818bde9fc <SoTransparencyElement::createInstance()>, data=data@entry=0) at /usr/src/debug/media-libs/coin-3.1.3-r2/Coin-3.1.3/src/misc/SoType.cpp:296
        typeData = <optimized out>
#5  0x000003a818bdeac2 in SoTransparencyElement::initClass () at /usr/src/debug/media-libs/coin-3.1.3-r2/Coin-3.1.3/src/elements/SoTransparencyElement.cpp:50
No locals.
#6  0x000003a818bdfea0 in SoElement::initElements () at /usr/src/debug/media-libs/coin-3.1.3-r2/Coin-3.1.3/src/elements/SoElement.cpp:449
No locals.
#7  0x000003a818be000b in SoElement::initClass () at /usr/src/debug/media-libs/coin-3.1.3-r2/Coin-3.1.3/src/elements/SoElement.cpp:517
No locals.
#8  0x000003a818d58cdb in SoDB::init () at /usr/src/debug/media-libs/coin-3.1.3-r2/Coin-3.1.3/src/misc/SoDB.cpp:290
        env = <optimized out>
#9  0x000000066590882a in main () at main.cpp:5
No locals.
(gdb) quit
Comment 1 eroen 2017-05-22 17:18:35 UTC
occam ~ # emerge --info media-libs/coin
Portage 2.3.6 (python 3.6.1-final-0, hardened/linux/amd64, gcc-6.3.0, glibc-2.23-r3, 4.9.24-hardened-o0 x86_64)
                         System Settings
System uname: Linux-4.9.24-hardened-o0-x86_64-Intel-R-_Core-TM-_i5-2520M_CPU_@_2.50GHz-with-gentoo-2.3
KiB Mem:     8000768 total,   2878928 free
KiB Swap:   16777212 total,  16710044 free
Timestamp of repository gentoo: Mon, 22 May 2017 10:30:01 +0000
Timestamp of repository eroen: Sun, 30 Oct 2016 21:58:42 +0000
sh bash 4.4_p12
ld GNU ld (Gentoo 2.27 p1.0) 2.27
ccache version 3.3.4 [disabled]
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.24.1-r1::gentoo
dev-lang/python:          2.7.13::gentoo, 3.4.6::gentoo, 3.5.3::gentoo, 3.6.1-r1::gentoo
dev-util/ccache:          3.3.4::gentoo
dev-util/cmake:           3.8.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.26.2::gentoo
sys-apps/sandbox:         2.10-r4::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r3::gentoo
sys-devel/automake:       1.15-r2::gentoo
sys-devel/binutils:       2.27::gentoo
sys-devel/gcc:            5.3.0::gentoo, 5.4.0-r3::gentoo, 6.3.0::gentoo
sys-devel/gcc-config:     1.8-r1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://
    priority: -1000
    sync-rsync-extra-opts: --exclude ChangeLog* --exclude /metadata/cache/ --stats --delay-updates -c

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

    location: /var/lib/overlays/sapher
    sync-type: git
    masters: gentoo

    location: /var/lib/overlays/wiktorb
    sync-type: git
    masters: gentoo

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

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

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

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

    location: /var/lib/layman/hardened-development
    masters: gentoo
    priority: 50

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

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

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

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

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

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

    location: /var/lib/layman/stuff
    sync-type: git
    masters: gentoo
    priority: 50

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

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

    location: /var/lib/layman/v-fox
    masters: gentoo
    priority: 50

ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-march=corei7-avx -pipe -Og -g -gdwarf-4"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/easy-rsa /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 /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=corei7-avx -pipe -Og -g -gdwarf-4"
EMERGE_DEFAULT_OPTS="--jobs=4 --autounmask --quiet-build --nospinner --verbose-conflicts --verbose-slot-rebuilds"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs binpkg-multi-instance cgroup collision-protect compressdebug config-protect-if-modified distlocks ebuild-locks fixlafiles installsources ipc-sandbox merge-sync network-sandbox news parallel-fetch parallel-install preserve-libs protect-owned sandbox sfperms split-log splitdebug strict test unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,--hash-style=gnu"
MAKEOPTS="-j4 -l10"
PORTAGE_RSYNC_EXTRA_OPTS="--exclude ChangeLog* --exclude /metadata/cache/ --stats --delay-updates -c"
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 a52 aac acl alsa amd64 apng audio audiofile avresample avx bash-completion bdf berkdb bluray bzip2 cairo caps cb cdda cdparanoia cdr cjk cli corefonts cracklib crypt cups curl cxx ddate declarative detex device-mapper dga dia djvu dri dts dvd dvi2tty dvipdfm ebook egl exif fam ffmpeg fftw fits flac fontconfig g3dvl gallium gbm gcrypt gdbm gif gimp git glamor glib glibc-omitfp gmp gnuplot gnutls gold gpm graphics graphviz gs gstreamer gtk gtk3 hardened highlight hscolour iconv icu id3tag idn imagemagick imlib inotify iproute2 ipv6 jbig jpeg jpeg2k jpg json justify kde kde4 kpathsea latex lcms libffi libssh2 libv4l luatex lvm lvm2 lzma lzo man metric mikmod mkv mms mmx mng modules mp3 mpeg mpg123 multilib multimedia musepack ncurses netlink nptl nut ocr odbc offensive ogg opengl openmp openvg optimization optimized-qmake opus pam pango pax_kernel pcre pdf pgf phonon pie png postscript private-headers pstricks pth publishers python3 qt3support qt4 raw readline samba sbsms scanner science sdl seccomp session smp sna sndfile speex spell sqlite sse sse2 sse3 sse4 sse41 sse4_1 sse4_2 ssh ssl ssp ssse3 svg t1lib tcpd tesseract theora threads tiff tls truetype udev unicode urandom usb v4l v4l2 vaapi video vorbis vpx webp wmf x264 xanim xattr xcb xcomposite xetex xft xinerama xkb xml xmlpatterns xorg xosd xpm xrandr xtpax xv xvid xvmc xz zlib zsh-completion" ABI_X86="32 64" 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="mmx sse sse2 avx sse3 ssse3 sse4_1 aes avx mmxext popcnt sse3 sse4_1 sse4_2 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="mouse keyboard evdev synaptics wacom" KERNEL="linux" L10N="en en-US en-GB eng" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en gb us en_US en_GB eng jbo no nb nn no_NO nb_NO nn_NO nor" LLVM_TARGETS="BPF X86" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python3_4" PYTHON_TARGETS="python2_7 python3_4 python3_5 python3_6" QEMU_SOFTMMU_TARGETS="x86_64 i386" RUBY_TARGETS="ruby21" SANE_BACKENDS="plustek" USERLAND="GNU" VIDEO_CARDS="intel i965 ilo" 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"
USE_PYTHON="2.7 3.3 3.4"

                        Package Settings

media-libs/coin-3.1.3-r2::gentoo was built with the following:
USE="bzip2 threads zlib -debug -doc -javascript -openal -simage -static-libs" ABI_X86="(64)"
Comment 2 Peter Levine 2017-07-07 04:52:20 UTC
Somewhere in the code there is manipulation of the memory location of a class object before its constructor is called.

Adding the following to src_configure should fix the problem:

if tc-is-gcc && [[ $(gcc-major-version) -ge 6 ]] ; then
	append-cppflags -flifetime-dse=1
Comment 3 maurerpe 2017-07-09 05:07:37 UTC
Created attachment 482402 [details, diff]

I found a patch for this issue in a fedora bug.  The issue was an improper initialization in a constructor.  Previous versions of GCC did the right thing, but gcc 6 enables additional optimization (mentioned above by Peter Levine) that leaves memhandler uninitialized.

Fedora Patch:
Comment 4 maurerpe 2017-07-09 05:08:45 UTC
Created attachment 482404 [details]

Ebuild that applies the above patch.
Comment 5 Peter Levine 2017-07-19 06:29:47 UTC