compiling GHC with a custom path to GCC

Remi Turk rturk at
Thu Feb 17 19:42:13 EST 2005

[Resent, with a few #ifdef FOO's removed from the body (still in
the attachement, and using gzip instead of bzip2 to prevent
"awaiting moderation ;)]

On Thu, Feb 17, 2005 at 11:29:41AM -0000, Simon Marlow wrote:
> On 17 February 2005 11:12, Remi Turk wrote:
> > when compiling the new ghc pre-releases made my gcc 2.95.3 die
> > with "internal compiler error", I tried to compile it with gcc
> > 3.4.3 (or rather, I thought it compiled with 3.4.1, and when that
> > died, compiled+installed gcc 3.4.3, tried again, say it die again
> > and only then noticed it was actually still using 2.95.3 ;) but
> > had quite some difficulty to actually get it to compile with, in
> > my case, /usr/local/bin/gcc3
> > 
> > When using the following command-line
> > 
> > CC=gcc3 CXX=g++3 nice ./configure --enable-hopengl
> > --prefix=/var/tmp/ghc --with-gcc=/usr/local/bin/gcc3 
> > 
> > stage1 still used gcc 2.95.3 to compile stage2 (okay, for --with-gcc
> > that's documented) 
> Really?  --with-gcc should set the gcc for stage1, AFAIK.  Is there a
> bug here?
> I've noticed gcc 2.95 crashing on my FreeBSD box too.  I should look
> into whether there's a workaround, otherwise we're hosed on FreeBSD 4.x.
> Cheers,
> 	Simon

In case you've got nothing else left to do.. ;)

The ghc command which perfectly repeatable kills gcc:

make[2]: Entering directory `/var/tmp/ghc-6.4.20050216/ghc/compiler'
../../ghc/compiler/stage1/ghc-inplace -H16m -O  -istage2/utils  -istage2/basicTypes  -istage2/types  -istage2/hsSyn  -istage2/prelude  -istage2/rename  -istage2/typecheck  -istage2/deSugar  -istage2/coreSyn  -istage2/specialise  -istage2/simplCore  -istage2/stranal  -istage2/stgSyn  -istage2/simplStg  -istage2/codeGen  -istage2/main  -istage2/profiling  -istage2/parser  -istage2/cprAnalysis  -istage2/compMan  -istage2/ndpFlatten  -istage2/iface  -istage2/cmm  -istage2/nativeGen  -istage2/ghci -Istage2 -DGHCI -package template-haskell -package unix -package readline -DUSE_READLINE -package Cabal -cpp -fglasgow-exts -fno-generics -Rghc-timing -I. -IcodeGen -InativeGen -Iparser -recomp -Rghc-timing  -H16M '-#include "hschooks.h"'    -c cmm/MachOp.hs -o stage2/cmm/MachOp.o  -ohi stage2/cmm/MachOp.hi
/tmp/ghc32662.hc: In function `s5dU_ret':
/tmp/ghc32662.hc:11210: Internal compiler error in `build_insn_chain', at global.c:1756

The dying gcc command:

gcc -x c cmm/MachOp.hc -o /tmp/ghc15388.raw_s -DDONT_WANT_WIN32_DLL_SUPPORT -fno-defer-pop -fomit-frame-pointer -fno-builtin -DSTOLEN_X86_REGS=4 -S -Wimplicit -O -D__GLASGOW_HASKELL__=604 -ffloat-store -I cmm -I stage2 -I . -I codeGen -I nativeGen -I parser -I /var/tmp/ghc-6.4.20050216/libraries/readline/include -I /var/tmp/ghc-6.4.20050216/libraries/unix/include -I /var/tmp/ghc-6.4.20050216/libraries/base/include -I /var/tmp/ghc-6.4.20050216/ghc/includes

The (naively) relevant part of the generated HC-file appears to
be the next "function" (with some code which doesn't seem to
matter for the crash removed). I have no idea whether this is of any
help for nailing this kind of nastiness down, so I'm not going to
spend more of my night on it ;)

I did attach the complete failing HC-file.


// compile The Killing Line
#define BAR 1
IF_(s5dU_ret) {
	W_ _c5ec;
#if BAR
	if (_c5ec < 0x5) goto _c5en;
	R1.p = (P_)(W_)GHCziBase_True_closure;
	JMP_((*((P_)((*Sp) + (-0x14)))) + (*Sp));
	switch (_c5ec) {
	    case 0x0: goto _c5eo;
	    case 0x1: goto _c5eo;
	    case 0x2: goto _c5eu;
	    case 0x3: goto _c5eo;
	    case 0x4: goto _c5eo;

Nobody can be exactly like me. Even I have trouble doing it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: MachOp.hc.bz2
Type: application/octet-stream
Size: 19035 bytes
Desc: not available
Url :

More information about the Glasgow-haskell-users mailing list