Bug 135651 - dev-lang/ghc-6.4.2 compiles incorrectly
Bug#: 135651 Product:  Gentoo Linux Version: 2006.0 Platform: x86
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: haskell@gentoo.org Reported By: marty.rosenberg@gmail.com
Component: Development
URL: 
Summary: dev-lang/ghc-6.4.2 compiles incorrectly
Keywords:  
Status Whiteboard: 
Opened: 2006-06-05 10:07 0000
Description:   Opened: 2006-06-05 10:07 0000
ghc compiled without a problem, but now, none of it's components seem to work
correctly.  All of the components seem to have the same problem. . .running out
of memory.  
USE="X -qt -kde sse sse2 dvd cdr x86 ncurses xmms -gtk -gtk2 -gnome alsa
-apache -apache2 nptl nptlonly mmx mmxext -xinerama"
CFLAGS="-march=pentium3 -msse -msse2 -O2 -pipe -fomit-frame-pointer -fgcse
-fgcse-lm -fgcse-las"
aside from those two variables, my make.conf is pretty much unchanged

------- Comment #1 From Duncan Coutts (RETIRED) 2006-06-05 10:36:41 0000 -------
And you are using gcc-4.1.1 on x86 right?

pasting your emerge --info would be helpful and the exact error message that
ghc/ghci reports.

------- Comment #2 From marty rosenberg 2006-06-05 11:15:49 0000 -------
I'm using gcc 4.1.1, 
root>emerge --info
Portage 2.1_rc4-r2 (default-linux/x86/2006.0, gcc-4.1.1, glibc-2.4-r3,
2.6.17-rc4-mm1 i686)
=================================================================
System uname: 2.6.17-rc4-mm1 i686 Intel(R) Pentium(R) M processor 1.73GHz
Gentoo Base System version 1.12.1
dev-lang/python:     2.4.3-r1
dev-python/pycrypto: 2.0.1-r5
dev-util/ccache:     [Not Present]
dev-util/confcache:  [Not Present]
sys-apps/sandbox:    1.2.18.1
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2
sys-devel/binutils:  2.16.1-r2
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.11-r5
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium3 -msse -msse2 -O2 -pipe -fomit-frame-pointer -fgcse
-fgcse-lm -fgcse-las"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config
/usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/gconf /etc/revdep-rebuild /etc/terminfo
/etc/texmf/web2c /etc/env.d"
CXXFLAGS="-march=pentium3 -msse -msse2 -O2 -pipe -fomit-frame-pointer -fgcse
-fgcse-lm -fgcse-las"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo
http://mirror.mcs.anl.gov/pub/gentoo/ http://gentoo.llarian.net/
http://distro.ibiblio.org/pub/linux/distributions/gentoo/ 
http://mirror.phy.olemiss.edu/mirror/gentoo
http://gentoo.cites.uiuc.edu/pub/gentoo/ http://gentoo.mirrors.pair.com/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress
--force --whole-file --delete --delete-after --stats --timeout=180
--exclude='/distfiles' --exclude='/local' --exclude='/packages'"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="X alsa apm arts avi berkdb bitmap-fonts cdr cli crypt cups dri dvd eds
emboss encode esd foomaticdb fortran gdbm gif gpm gstreamer imlib ipv6 isdnlog
jpeg libg++ libwww mad mikmod mmx mmxext motif mp3 mpeg ncurses nls nptl
nptlonly ogg opengl oss pam pcre pdflib perl png pppd python quicktime readline
reflection sdl session spell spl sse sse2 ssl tcpd truetype truetype-fonts
type1-fonts udev vorbis x86 xml xmms xorg xv zlib elibc_glibc kernel_linux
userland_GNU"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS,
LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS


when I run ghc, ghci or hsc2hs my system becomes very unresponsive as the ghc
application begins to take up all of my ram, then begins to expand into my
swap.  

 mjrosenb>ghci               
   ___         ___ _
  / _ \ /\  /\/ __(_)
 / /_\// /_/ / /  | |      GHC Interactive, version 6.4.2, for Haskell 98.
/ /_\\/ __  / /___| |      http://www.haskell.org/ghc/
\____/\/ /_/\____/|_|      Type :? for help.

ghc-6.4.2: out of memory (requested 1048576 bytes)


 mjrosenb>ghc hello.hs -v
Glasgow Haskell Compiler, Version 6.4.2, for Haskell 98, compiled by GHC
version 6.4.2
Using package config file: /usr/lib/ghc-6.4.2/package.conf
ghc-6.4.2: out of memory (requested 1048576 bytes)

hsc2hs just calls ghc, so I'm not going to post it unless someone thinks it
will be helpful

------- Comment #3 From Duncan Coutts (RETIRED) 2006-06-08 14:10:25 0000 -------
Link to upstream bug report

http://hackage.haskell.org/trac/ghc/ticket/778

------- Comment #4 From Duncan Coutts (RETIRED) 2006-06-12 15:24:14 0000 -------
Ok, I have managed to reproduce this bug. I'm trying to narrow it down.

------- Comment #5 From Duncan Coutts (RETIRED) 2006-06-13 02:20:13 0000 -------
So I can reproduce this with a stable x86 profile, gcc-4.1.1 and
CFLAGS="-march=pentium3 -O2 -pipe"

I'm now trying without the -march=pentium3 bit to see if it's just gcc-4.1.1
that is the problem.

------- Comment #6 From Duncan Coutts (RETIRED) 2006-06-13 04:06:00 0000 -------
Ok I can reproduce it with just CFLAGS="-O2 -pipe" so it looks to be a bad
interaction between ghc and gcc-4.1.1. I think we've previously tested with
gcc-4.0.x and gcc-4.1.0 but I'm just going to double check.

------- Comment #7 From Duncan Coutts (RETIRED) 2006-06-13 16:13:24 0000 -------
Also reproducable with gcc-4.1.0-r1

------- Comment #8 From Duncan Coutts (RETIRED) 2006-06-15 05:24:25 0000 -------
Fixed! Patch applied in ghc-6.4.1-r3 and ghc-6.4.2. So you'll need to sync and
re-emerge from a working ghc or ghc-bin.

Marty, thanks very much for helping us to track down this bug. It now works for
me using -O3 and all your other original CFLAGS. If you still find any problems
please re-open this bug.