When using gcc-5.1.0 to build games-board/gnubg strange effects occur. - When compiles with -O2 (my standard setting), gnubg goes in to a loop (in memset) *before* function main is entered. - when compiled with -O1 it gets a segment fault in memset *before* function main is entered. -when compiled with -O0 it works. Compileing gnubg with -O3 and gcc-4.9.2, everything is OK. Note, I have recompiled most parts of my system (including glibc) with gcc-5.1.0 during the last weeks. Many thanks for some hints, Helmut emerge --info games-board/gnubg Portage 2.2.20 (python 3.4.3-final-0, default/linux/amd64/13.0/desktop, gcc-5.1.0, glibc-2.20-r2, 4.1.0-rc7 x86_64) ================================================================= System Settings ================================================================= System uname: Linux-4.1.0-rc7-x86_64-AMD_Phenom-tm-_II_X4_940_Processor-with-gentoo-2.2 KiB Mem: 7906012 total, 5198576 free KiB Swap: 2097148 total, 2097148 free Timestamp of repository gentoo: Fri, 12 Jun 2015 07:45:01 +0000 sh bash 4.3_p39 ld GNU ld (Gentoo 2.25 p1.2) 2.25 ccache version 3.2.2 [disabled] app-shells/bash: 4.3_p39::gentoo dev-java/java-config: 2.2.0::gentoo dev-lang/perl: 5.20.2-r1::gentoo dev-lang/python: 2.7.10::gentoo, 3.4.3::gentoo dev-util/ccache: 3.2.2::gentoo dev-util/cmake: 3.2.3::gentoo dev-util/pkgconfig: 0.28-r3::gentoo sys-apps/baselayout: 2.2::gentoo sys-apps/openrc: 0.16.4::gentoo sys-apps/sandbox: 2.6-r1::gentoo sys-devel/autoconf: 2.13::gentoo, 2.69-r1::gentoo sys-devel/automake: 1.9.6-r4::gentoo, 1.10.3-r1::gentoo, 1.11.6-r1::gentoo, 1.12.6::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo sys-devel/binutils: 2.25-r1::gentoo sys-devel/gcc: 4.8.4::gentoo, 4.9.2::gentoo, 5.1.0::local, 6.0.0_alpha20150419::toolchain sys-devel/gcc-config: 1.8::gentoo sys-devel/libtool: 2.4.6-r1::gentoo sys-devel/make: 4.1-r1::gentoo sys-kernel/linux-headers: 4.0::gentoo (virtual/os-headers) sys-libs/glibc: 2.20-r2::gentoo Repositories: gentoo location: /usr/portage sync-type: rsync sync-uri: rsync://rsync15.de.gentoo.org/gentoo-portage priority: -1000 local location: /usr/local/portage masters: gentoo priority: 0 java location: /usr/local/portage/layman/java sync-type: laymansync sync-uri: git://git.overlays.gentoo.org/proj/java.git masters: gentoo priority: 50 lisp location: /usr/local/portage/layman/lisp sync-type: laymansync sync-uri: git://git.overlays.gentoo.org/proj/lisp.git masters: gentoo priority: 50 qt location: /usr/local/portage/layman/qt sync-type: laymansync sync-uri: git://git.overlays.gentoo.org/proj/qt.git masters: gentoo priority: 50 science location: /usr/local/portage/layman/science sync-type: laymansync sync-uri: git://git.overlays.gentoo.org/proj/sci.git masters: gentoo priority: 50 sunrise location: /usr/local/portage/layman/sunrise sync-type: laymansync sync-uri: git://git.overlays.gentoo.org/proj/sunrise-reviewed.git masters: gentoo priority: 50 toolchain location: /usr/local/portage/layman/toolchain sync-type: laymansync sync-uri: git://git.overlays.gentoo.org/proj/toolchain.git masters: gentoo priority: 50 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="*" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-mtune=native -O2 -msse3 -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 /var/lib/hsqldb" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.5/ext-active/ /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.5/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.5/ext-active/ /etc/php/cli-php5.6/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="-mtune=native -O2 -msse3 -pipe" DISTDIR="/usr/portage/distfiles" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo " LANG="en_US.iso88591" LDFLAGS="-Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j4" 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" PORTAGE_TMPDIR="/var/tmp" USE="3dnow 3dnowext 3dnowprefetch X a52 aac acl acpi alsa amd64 avahi berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam ffmpeg fftw firefox flac fortran fuse gdbm gfortran gif gimp glamor gpm gtk gtk3 iconv ipv6 jpeg lapack lcms libnotify mad mmx mmxext mng modules mp3 mp4 mpeg multilib ncurses nls nptl nptlonly ogg opengl openmp pam pango pcre pdf png policykit ppds python qt qt3support qt4 qt5 readline sdl session smp spell sqlite sqlite3 sse sse2 sse3 sse4a ssl startup-notification svg systemd tcl tcpd threads tiff tk truetype udev udisks unicode upower usb vorbis wxwidgets x264 xcb xml xulrunner xv xvid zlib" ABI_X86="64" 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="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="3dnow mmx 3dnowext mmxext popcnt sse sse2 sse3 sse4a" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="pc multiboot" INPUT_DEVICES="keyboard mouse evdev wacom" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en de" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python3_4" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="radeon 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: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON ================================================================= Package Settings ================================================================= games-board/gnubg-1.04.000::gentoo was built with the following: USE="gtk opengl python sqlite threads" ABI_X86="64" CPU_FLAGS_X86="sse sse2 -avx" PYTHON_TARGETS="python2_7"
Could you compile it with -fsanitize=undefined and see if anything pops up?
Also many bugs were already fixed on the gcc-5 branch. Please try a newer gcc snapshot.
(In reply to octoploid from comment #1) > Could you compile it with -fsanitize=undefined and see if anything pops up? The strange thing, it works, as well as when compiled with gcc-6.0.0-alpha20150531 without this option. Thanks, Helmut
doesn't really seem to be a game bug to me.
Same here with gcc-5.2.0 and -fsanitize=undefined.
(In reply to Michael Weber from comment #5) > Same here with gcc-5.2.0 and -fsanitize=undefined. gcc-5.2.0 and -O0 works. # emerge --info Portage 2.2.20.1 (python 2.7.10-final-0, default/linux/amd64/13.0/developer, gcc-5.2.0, glibc-2.21-r1, 4.0.5-gentoo-headless.0 x86_64) ================================================================= System uname: Linux-4.0.5-gentoo-headless.0-x86_64-Intel_Core_2_Duo_P9xxx_-Penryn_Class_Core_2-with-gentoo-2.2 KiB Mem: 3948808 total, 980172 free KiB Swap: 2097148 total, 2076920 free sh bash 4.3_p42 ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1 distcc 3.2rc1 x86_64-pc-linux-gnu [disabled] ccache version 3.2.3 [enabled] app-shells/bash: 4.3_p42::gentoo dev-java/java-config: 2.2.0::gentoo dev-lang/perl: 5.22.0::gentoo dev-lang/python: 2.7.10::gentoo, 3.4.3::gentoo dev-util/ccache: 3.2.3::gentoo dev-util/cmake: 3.3.1-r1::gentoo dev-util/pkgconfig: 0.28-r3::gentoo sys-apps/baselayout: 2.2::gentoo sys-apps/openrc: 0.17::gentoo sys-apps/sandbox: 2.6-r1::gentoo sys-devel/autoconf: 2.13::gentoo, 2.69-r1::gentoo sys-devel/automake: 1.10.3::gentoo, 1.11.6-r1::gentoo, 1.12.6::gentoo, 1.13.4::gentoo, 1.14.1::gentoo, 1.15::gentoo sys-devel/binutils: 2.25.1-r1::gentoo sys-devel/gcc: 4.9.3::gentoo, 5.2.0::gentoo sys-devel/gcc-config: 1.8::gentoo sys-devel/libtool: 2.4.6-r1::gentoo sys-devel/make: 4.1-r1::gentoo sys-kernel/linux-headers: 4.1::gentoo (virtual/os-headers) sys-libs/glibc: 2.21-r1::gentoo Repositories: gentoo location: /usr/portage sync-type: git sync-uri: git://git.gentoo.org/repo/gentoo.git priority: -1000 ceres location: /etc/portage/overlay masters: gentoo priority: 0 fslmude location: /var/lib/layman/fslmude sync-type: git sync-uri: git://git.fs.lmu.de/fslmude-overlay.git masters: gentoo priority: 50 gamerlay location: /var/lib/layman/gamerlay sync-type: git sync-uri: git://git.gentoo.org/proj/gamerlay.git masters: gentoo priority: 50 java location: /var/lib/layman/java sync-type: git sync-uri: git://anongit.gentoo.org/proj/java.git masters: gentoo priority: 50 lorem_ipsum location: /var/lib/layman/lorem_ipsum sync-type: git sync-uri: git://github.com/lorem-ipsum/ebuilds.git masters: gentoo priority: 50 xmw location: /var/lib/layman/xmw sync-type: git sync-uri: git://anongit.gentoo.org/dev/xmw.git masters: gentoo priority: 50 ACCEPT_KEYWORDS="amd64 ~amd64" ACCEPT_LICENSE="* -@EULA" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-O2 -pipe -march=core2 -mcx16 -msahf -mno-movbe -mno-aes -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mno-lzcnt -mno-rdrnd -mno-f16c -mno-fsgsbase --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=core2" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc /usr/bin/trivdm /usr/lib64/libreoffice/program/sofficerc /usr/share/gnupg/qualified.txt /var/bind /var/lib/hsqldb /var/spool/munin-async/.ssh" CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5.6/ext-active/ /etc/php/cgi-php5.6/ext-active/ /etc/php/cli-php5.6/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=core2 -mcx16 -msahf -mno-movbe -mno-aes -mno-pclmul -mno-popcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-bmi2 -mno-tbm -mno-avx -mno-avx2 -mno-sse4.2 -mno-sse4.1 -mno-lzcnt -mno-rdrnd -mno-f16c -mno-fsgsbase --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=4096 -mtune=core2" DISTDIR="/var/cache/distfiles" EMERGE_DEFAULT_OPTS=" --buildpkg y" FCFLAGS="-O2 -pipe" FEATURES="assume-digests binpkg-logs buildpkg ccache cgroup collision-protect compress-build-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms sign split-log strict test-fail-continue unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync" FFLAGS="-O2 -pipe" GENTOO_MIRRORS="https://lore.xmw.de/gentoo/" LANG="en_US.UTF-8" LDFLAGS="-Wl,--hash-style=gnu -Wl,-O1 -Wl,--as-needed" MAKEOPTS="-j4" PKGDIR="/var/cache/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" PORTAGE_TMPDIR="/var/tmp" USE="X a52 aac acl acpi alsa amd64 berkdb branding bzip2 cairo cdda cdr cli consolekit cracklib crypt cups cxx djvu dri dts dvd dvdr emboss encode exif fam firefox flac fortran gdbm gif glamor gpm gtk iconv ipv6 jbig jpeg jpeg2k lcms ldap libnotify mad mmx mmxext mng modules mp3 mp4 mpeg multilib ncurses nls nptl ogg opengl openmp pam pango pcre pdf png policykit ppds qt3support qt4 raw readline sdl seccomp session snmp spell sse sse2 ssl ssse3 startup-notification svg tcpd threads tiff truetype udev udisks unicode upower usb vim-syntax vorbis wxwidgets x264 xcb xml xv xvid zlib zsh-completion" ABI_X86="64" ALSA_CARDS="intel-hda" 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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 sse3 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="de en en_US en_GB" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-5" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby22" USERLAND="GNU" VIDEO_CARDS="i965 intel nvidia radeon" 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_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
if you build with -O2 -fno-builtin, does it work ?
http://lists.gnu.org/archive/html/bug-gnubg/2015-07/msg00011.html
it's a bug in gnubg. their common.h does: #if !_GNU_SOURCE && !defined (__attribute__) #define __attribute__(X) #endif and then it proceeds to include glibc headers. since glibc relies on gcc attributes, things start to fall down quickly. specifically, the problem here is that w/newer gcc defaulting to a newer C standard where the behavior of "static inline" has changed. glibc would use __attribute__((gnu_inline)) on the string functions to get the correct behavior, but gnubg has broken that. that leads to copying.c including string.h which ends up including local dummy copies of the string functions (like memset). so when gnubg starts up, glibc and such libraries call memset which is the dummy call in gnubg which calls itself thus getting stuck.
i e-mailed upstream and cc-ed people in that older thread (although for some reason my e-mail isn't showing up in the archive) in the mean time, i committed this hack: http://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e121815fa352616db9031e5c366065c577795b22