gcc-2.95.3 internal error on head/MachOp.hs

Donald Bruce Stewart dons at cse.unsw.edu.au
Thu Sep 9 01:48:17 EDT 2004


Hey,

A start on the gcc-2.95.3 issue provoked by MachOp.hs in the head, on
the openbsd nightly builds. I haven't solved this, but I thought I'd put
out some info, in case someone else can spot it, or has some hints...

Firstly, MachOp.hs does compile happily -fasm.  And the bug seems
unaffected whether I use -Onot or -O.

Here is the problem, while trying to build the stage2 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/cbits  -istage2/iface  -istage2/cmm  -istage2/nativeGen  -istage2/ghci -DGHCI -package template-haskell -package unix -package readline  -cpp -fglasgow-exts -fno-generics -Rghc-timing -I. -IcodeGen -InativeGen -Iparser -recomp -Rghc-timing -O -dcore-lint -H24m -DDEBUG -H16M '-#include "hschooks.h"'    -c cmm/MachOp.hs -o stage2/cmm/MachOp.o  -ohi stage2/cmm/MachOp.hi
        /tmp/ghc4128.hc: In function `s5ey_ret':
        /tmp/ghc4128.hc:10870: Internal compiler error in `build_insn_chain', at global.c:1756
        Please submit a full bug report.
        See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

------------------------------------------------------------------------

The relevant bit of gcc is global.c:1756, the comment seems relevant.
I've marked the line that appears in the barf msg above.

gcc-2.95.3:global.c:
      /* Stop after we pass the end of the last basic block.  Verify that
         no real insns are after the end of the last basic block.

         We may want to reorganize the loop somewhat since this test should
         always be the right exit test.  */
      if (b == n_basic_blocks)
        {
          for (first = NEXT_INSN (first) ; first; first = NEXT_INSN (first))
            if (GET_RTX_CLASS (GET_CODE (first)) == 'i'
                && GET_CODE (PATTERN (first)) != USE)
1756:         abort ();
          break;
        }

The source says:
        'i' an rtx code for a machine insn (INSN, JUMP_INSN, CALL_INSN)

------------------------------------------------------------------------

And here is the .hc code that provokes the bug, line 10870 is at the
bottom.  The full file is at www.cse.unsw.edu.au/~dons/ghc1802.hc. I
can't see anything strange code generated here, but maybe someone else
can?

s5ey_ comes from isCommutableMachOp, I think:

        isCommutableMachOp :: MachOp -> Bool
        isCommutableMachOp mop =
          case mop of
                MO_Add _                -> True
                MO_Eq _                 -> True
                MO_Ne _                 -> True
                MO_Mul _                -> True
                MO_S_MulMayOflo _       -> True
                MO_U_MulMayOflo _       -> True
                MO_And _                -> True
                MO_Or _                 -> True
                MO_Xor _                -> True
                _other                  -> False

And the .hc code:

        EI_(GHCziBase_False_closure);
        EI_(GHCziBase_True_closure);
        IF_(s5ey_ret) {
                W_ _c5JC;
                FB_
                _c5JC = (W_)((*((StgWord16*)((*R1.p) + (-0x2)))));
                if (_c5JC < 0x5) goto _c5JM;
                if (_c5JC < 0x14) goto _c5JN;
                if (_c5JC < 0x15) goto _c5JO;
                if (_c5JC < 0x16) goto _c5JP;
                if (_c5JC != 0x16) goto _c5JQ;
                R1.p = (P_)(W_)GHCziBase_True_closure;
                Sp=Sp+1;
                JMP_(*((P_)((*Sp) + (-0x14))));
            _c5JQ:
                R1.p = (P_)(W_)GHCziBase_False_closure;
                Sp=Sp+1;
                JMP_(*((P_)((*Sp) + (-0x10))));
            _c5JR:
                R1.p = (P_)(W_)GHCziBase_True_closure;
                Sp=Sp+1;
                JMP_(*((P_)((*Sp) + (-0x14))));
            _c5JS:
                R1.p = (P_)(W_)GHCziBase_True_closure;
                Sp=Sp+1;
                JMP_(*((P_)((*Sp) + (-0x14))));
            _c5JT:
                R1.p = (P_)(W_)GHCziBase_True_closure;
                Sp=Sp+1;
                JMP_(*((P_)((*Sp) + (-0x14))));
            _c5JU:
                R1.p = (P_)(W_)GHCziBase_True_closure;
                Sp=Sp+1;
                JMP_(*((P_)((*Sp) + (-0x14))));
            _c5JV:
                if (_c5JC != 0x5) goto _c5JQ;
                R1.p = (P_)(W_)GHCziBase_True_closure;
                Sp=Sp+1;
                JMP_(*((P_)((*Sp) + (-0x14))));
            _c5JP:
                R1.p = (P_)(W_)GHCziBase_True_closure;
                Sp=Sp+1;
                JMP_(*((P_)((*Sp) + (-0x14))));
            _c5JO:
                R1.p = (P_)(W_)GHCziBase_True_closure;
                Sp=Sp+1;
                JMP_(*((P_)((*Sp) + (-0x14))));
            _c5JN:
                if (_c5JC < 0x9) goto _c5JV;
                if (_c5JC != 0x9) goto _c5JQ;
                R1.p = (P_)(W_)GHCziBase_True_closure;
                Sp=Sp+1;
                JMP_(*((P_)((*Sp) + (-0x14))));
            _c5JM:
                switch (_c5JC) {
                    case 0x0: goto _c5JR;
                    case 0x1: goto _c5JQ;
                    case 0x2: goto _c5JS;
                    case 0x3: goto _c5JT;
                    case 0x4: goto _c5JU;
                }
                FE_
        } /* line 10870 */



More information about the Cvs-ghc mailing list