Remi Turk wrote:
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
  
At least this proves that it isn't a hardware problem.  :)
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". 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.

Greetings,
Remi

// compile code which doesn't seem to matter for the crash
#define FOO 0
// compile The Killing Line
#define BAR 1
IF_(s5dU_ret) {
	W_ _c5ec;
	FB_
#if FOO
	_c5ec = (W_)((*((StgWord16*)((*R1.p) + (-0x2)))));
#endif
#if BAR
	if (_c5ec < 0x5) goto _c5en;
#endif
#if FOO
	if (_c5ec > 0x16) goto _c5eo;
	if (_c5ec < 0x14) goto _c5ep;
	switch (_c5ec-20) {
	    case 0x0: goto _c5eq;
	    case 0x1: goto _c5er;
	    case 0x2: goto _c5es;
	}
#endif
    _c5eo:
#if FOO
	R1.p = (P_)(W_)GHCziBase_False_closure;
	Sp=Sp+1;
	JMP_((*((P_)((*Sp) + (-0x10)))) + (*Sp));
    _c5et:
	R1.p = (P_)(W_)GHCziBase_True_closure;
	Sp=Sp+1;
	JMP_((*((P_)((*Sp) + (-0x14)))) + (*Sp));
#endif
    _c5eu:
#if FOO
	R1.p = (P_)(W_)GHCziBase_True_closure;
	Sp=Sp+1;
	JMP_((*((P_)((*Sp) + (-0x14)))) + (*Sp));
    _c5ev:
	R1.p = (P_)(W_)GHCziBase_True_closure;
	Sp=Sp+1;
	JMP_((*((P_)((*Sp) + (-0x14)))) + (*Sp));
    _c5ew:
	R1.p = (P_)(W_)GHCziBase_True_closure;
	Sp=Sp+1;
	JMP_((*((P_)((*Sp) + (-0x14)))) + (*Sp));
    _c5ex:
	if (_c5ec != 0x5) goto _c5eo;
	R1.p = (P_)(W_)GHCziBase_True_closure;
	Sp=Sp+1;
	JMP_((*((P_)((*Sp) + (-0x14)))) + (*Sp));
    _c5eq:
	R1.p = (P_)(W_)GHCziBase_True_closure;
	Sp=Sp+1;
	JMP_((*((P_)((*Sp) + (-0x14)))) + (*Sp));
    _c5er:
	R1.p = (P_)(W_)GHCziBase_True_closure;
	Sp=Sp+1;
	JMP_((*((P_)((*Sp) + (-0x14)))) + (*Sp));
    _c5es:
	R1.p = (P_)(W_)GHCziBase_True_closure;
	Sp=Sp+1;
	JMP_((*((P_)((*Sp) + (-0x14)))) + (*Sp));
    _c5ep:
	if (_c5ec > 0x9) goto _c5eo;
	if (_c5ec < 0x9) goto _c5ex;
#endif
	R1.p = (P_)(W_)GHCziBase_True_closure;
	Sp=Sp+1;
	JMP_((*((P_)((*Sp) + (-0x14)))) + (*Sp));
    _c5en:
	switch (_c5ec) {
#if FOO
	    case 0x0: goto _c5et;
	    case 0x1: goto _c5eo;
	    case 0x2: goto _c5eu;
	    case 0x3: goto _c5ev;
	    case 0x4: goto _c5ew;
#else
	    case 0x0: goto _c5eo;
	    case 0x1: goto _c5eo;
	    case 0x2: goto _c5eu;
	    case 0x3: goto _c5eo;
	    case 0x4: goto _c5eo;
#endif
	}
	FE_
}