Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 419761 - dev-lang/R with sys-devel/gcc-4.7 - R.bin segmentation fault when byte-compiling package 'base'
Summary: dev-lang/R with sys-devel/gcc-4.7 - R.bin segmentation fault when byte-compil...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GCC Porting (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: gcc-4.7
  Show dependency tree
 
Reported: 2012-06-05 13:56 UTC by Jauhien Piatlicki (RETIRED)
Modified: 2012-06-26 16:46 UTC (History)
4 users (show)

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


Attachments
build.log (build.log,142.16 KB, text/plain)
2012-06-05 13:56 UTC, Jauhien Piatlicki (RETIRED)
Details
build.log (build.log,138.30 KB, text/plain)
2012-06-06 18:44 UTC, Jauhien Piatlicki (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jauhien Piatlicki (RETIRED) gentoo-dev 2012-06-05 13:56:12 UTC
Created attachment 314305 [details]
build.log

emerge --info
Portage 2.2.0_alpha109 (default/linux/x86/10.0, gcc-4.7.0, glibc-2.14.1-r3, 3.4.0-gentoo i686)
=================================================================
System uname: Linux-3.4.0-gentoo-i686-Intel-R-_Atom-TM-_CPU_N280_@_1.66GHz-with-gentoo-2.1
Timestamp of tree: Sun, 03 Jun 2012 09:30:01 +0000
app-shells/bash:          4.2_p20
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.3-r2, 3.1.4-r3, 3.2.3
dev-util/cmake:           2.8.7-r5
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.9.8.4
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r2, 4.7.0
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r3
Repositories: gentoo lisp sage-on-gentoo science gentoo-haskell sunrise local-fix
Installed sets: 
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O3 -march=native -mtune=native -mfpmath=sse  -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /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="-O3 -march=native -mtune=native -mfpmath=sse  -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles metadata-transfer news parallel-fetch parse-eapi-ebuild-head preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="uk_UA.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="be be_BY en en_GB ru uk"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/layman/lisp /usr/layman/sage-on-gentoo /usr/layman/science /usr/layman/haskell /usr/layman/sunrise /usr/local/portage/fix"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aac acl acpi alsa bash-completion berkdb bzip2 cairo cli cracklib crypt cxx dbus djvu dri emacs encode expat ffmpeg fftw flac fortran gdbm gif gpm gtk iconv icu java javascript jpeg jpeg2k latex libnotify lm_sensors mad mbox mmx mmxext modplug modules mp3 mp4 mudflap ncurses nls nptl nsplugin ogg opengl openmp pam pcre pdf perl png policykit pppd pythia8 python qt3support readline session sndfile sqlite sqlite3 sse sse2 ssl startup-notification system-sqlite tcpd threads tiff truetype udev unicode v4l vorbis x86 xml xmlrpc xorg zlib zsh-completion" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" 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 ubx" INPUT_DEVICES="synaptics evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="be be_BY en en_GB ru uk" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="intel" 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.1"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Denis Dupeyron (RETIRED) gentoo-dev 2012-06-06 17:05:22 UTC
This looks like a gcc issue to me, plus I'd have no clue how to fix this, thus reassigning to GCC team. Guys, if you need support do not hesitate to ask, but be prepared to get "Huh?" as an answer.

Thanks,
Denis.
Comment 2 Sébastien Fabbro (RETIRED) gentoo-dev 2012-06-06 17:36:51 UTC
first thing to try is to get rid of that nasty flag -mfpmath=sse from your configuration.
Comment 3 Jauhien Piatlicki (RETIRED) gentoo-dev 2012-06-06 18:44:38 UTC
Created attachment 314457 [details]
build.log

The same problem without "nasty" flag.
Comment 4 Sébastien Fabbro (RETIRED) gentoo-dev 2012-06-06 20:52:48 UTC
i can reproduce. seems that -O3 is guilty. could you report R upstream? thanks.
Comment 5 Jauhien Piatlicki (RETIRED) gentoo-dev 2012-06-06 20:54:32 UTC
(In reply to comment #4)
> i can reproduce. seems that -O3 is guilty. could you report R upstream?
> thanks.

Ok, I'll see whether -O3 causes problem and then report this bug to R upstream.
Comment 6 Denis Dupeyron (RETIRED) gentoo-dev 2012-06-06 21:04:15 UTC
Could you guys try to narrow it down to which -O3 suboption is actually the culprit? I'm sure we have better chances of upstream actually looking at it if we tell them what exactly is failing.

Thanks,
Denis.
Comment 7 Ryan Hill (RETIRED) gentoo-dev 2012-06-07 02:24:33 UTC
There are some known bad-code issues with -O3.  4.7.1 should be out in a week or so.
Comment 8 Ryan Hill (RETIRED) gentoo-dev 2012-06-07 04:08:58 UTC
Nope, still fails with
gcc version 4.7.0-pre9999 20120607 (prerelease) commit 80506925c070c6576bd6a37e181417929fbe0956
Comment 9 Jauhien Piatlicki (RETIRED) gentoo-dev 2012-06-07 09:46:16 UTC
(In reply to comment #6)
> Could you guys try to narrow it down to which -O3 suboption is actually the
> culprit? I'm sure we have better chances of upstream actually looking at it
> if we tell them what exactly is failing.
> 
> Thanks,
> Denis.

Hmm, when I use -O3 flag it fails, but when I try to replace it but separate -fxxxxx flags it does not fail. I've just tried to put flags from `man gcc` that are equivalent to -O3 in CFLAGS variable.
Anyway I will report bug to upstream about failing with -O3.
Comment 10 Jauhien Piatlicki (RETIRED) gentoo-dev 2012-06-07 10:06:22 UTC
Bug reported to upstream: https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=14940
Comment 11 Jauhien Piatlicki (RETIRED) gentoo-dev 2012-06-07 13:14:12 UTC
Upstream says it's not R but gcc bug. It seems they are right, so waiting for fixing problems in gcc.

>Brian Ripley:
>Maybe 10 times in the gcc4 series, gcc -O3 bugs have caused R builds to
>fail, so we are not likely to believe that this time the bug is in R 
>without very detailed evidence
Comment 12 Kacper Kowalik (Xarthisius) (RETIRED) gentoo-dev 2012-06-07 21:57:47 UTC
CFLAGS="-O2 -fipa-cp-clone" is also sufficient to trigger it
Comment 13 Denis Dupeyron (RETIRED) gentoo-dev 2012-06-20 15:41:14 UTC
(In reply to comment #12)
> CFLAGS="-O2 -fipa-cp-clone" is also sufficient to trigger it

Thanks a lot for bisecting this. This saved me a lot of cycles on my slow dev box.

I have confirmed that too on gcc-4.7.1 which was recently released. I'm working on a temporary fix.

Denis.
Comment 14 Denis Dupeyron (RETIRED) gentoo-dev 2012-06-20 18:23:09 UTC
I have fixed R-2.15.0.ebuild as in the diff below. It doesn't completely fix the issue but at least it lets users keep -O3 even with gcc-4.7. It's not ideal but we have plenty of uglier and less subtle flag-o-matrickery in the tree.

Also, I have CCed the toolchain guys in case they they can help with this. I'm not sure however that this is a gcc issue, it may be R. I will leave this bug open until we have a real upstream fix or they do not agree to fix it.

Denis.

Index: R-2.15.0.ebuild
===================================================================
RCS file: /var/cvsroot/gentoo-x86/dev-lang/R/R-2.15.0.ebuild,v
retrieving revision 1.5
diff -u -B -r1.5 R-2.15.0.ebuild
--- R-2.15.0.ebuild	19 Jun 2012 19:16:55 -0000	1.5
+++ R-2.15.0.ebuild	20 Jun 2012 17:37:05 -0000
@@ -4,7 +4,7 @@
 
 EAPI=4
 
-inherit bash-completion-r1 autotools eutils flag-o-matic fortran-2 multilib versionator
+inherit bash-completion-r1 autotools eutils flag-o-matic fortran-2 multilib versionator toolchain-funcs
 
 BCP=${PN}-20120306.bash_completion
 DESCRIPTION="Language and environment for statistical computing and graphics"
@@ -58,6 +58,11 @@
 	filter-ldflags -Wl,-Bdirect -Bdirect
 	# avoid using existing R installation
 	unset R_HOME
+	# Temporary fix for bug #419761
+	if [[ ($(tc-getCC) == *gcc) && ($(gcc-version) == 4.7) ]]; then
+		append-flags -fno-ipa-cp-clone
+	fi
+	exit
 }
 
 src_prepare() {
Comment 15 Gabriel Marcano 2012-06-21 17:21:04 UTC
I haven't done much testing (mostly due to lack of experience), but it appears that in some cases (at the very least in my system) the fix for the ebuild makes emerging R fail with the rather long error:
The ebuild phase 'setup' has exited unexpectedly. This type of behavior
is known to be triggered by things such as failed variable assignments
(bug #190128) or bad substitution errors (bug #200313). Normally, before
exiting, bash should have displayed an error message above. If bash did
not produce an error message above, it's possible that the ebuild has
called `exit` when it should have called `die` instead. This behavior
may also be triggered by a corrupt bash binary or a hardware problem
such as memory or cpu malfunction. If the problem is not reproducible or
it appears to occur randomly, then it is likely to be triggered by a
hardware problem. If you suspect a hardware problem then you should try
some basic hardware diagnostics such as memtest. Please do not report
this as a bug unless it is consistently reproducible and you are sure
that your bash binary and hardware are functioning properly.

This happens right at the very beginning of the emerge, and it happened consistently. I copied the ebuild to a local repository, and took the hint that perhaps the "exit" in the diff is what was causing the problem. I removed it from the ebuild in the local repository, and R can now successfully emerge on my system. Perhaps this should be fixed, or perhaps the problem is more complex than that?
Comment 16 Denis Dupeyron (RETIRED) gentoo-dev 2012-06-22 15:54:27 UTC
(In reply to comment #15)
> This happens right at the very beginning of the emerge, and it happened
> consistently. I copied the ebuild to a local repository, and took the hint
> that perhaps the "exit" in the diff is what was causing the problem. I
> removed it from the ebuild in the local repository, and R can now
> successfully emerge on my system. Perhaps this should be fixed, or perhaps
> the problem is more complex than that?

Yes, the problem is indeed more complicated than that. You know, getting old is dramatic. Your brain melts and slowly changes into this useless goop, and this in turn makes you forget about removing debugging code once you're done working on an ebuild... ;o)

Thanks a lot for spotting that. It is now fixed.

Denis.
Comment 17 Denis Dupeyron (RETIRED) gentoo-dev 2012-06-26 16:46:12 UTC
Closing that as it's blocking the gcc-4.7 tracker.

Denis.