Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#1285 closed bug (fixed)

panic in HEAD building base library

Reported by: Isaac Dupree Owned by:
Priority: normal Milestone: 6.8.1
Component: Compiler Version: 6.7
Keywords: Cc:
Operating System: Linux Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Compile base with -O0 Blocked By:
Blocking: Related Tickets:

Description

Building base-2.1...
../../compiler/ghc-inplace -package-name base-2.1 --make -hide-all-packages -i -idist/build/autogen -i. -Iinclude -I../../includes -I../../rts -#include "HsBase.h" -odir dist/build -hidir dist/build -package rts-1.0 -O -fglasgow-exts -package-name base -v0 -O0 -fgenerics -cpp Control.Applicative Control.Arrow Control.Concurrent Control.Concurrent.Chan Control.Concurrent.MVar Control.Concurrent.QSem Control.Concurrent.QSemN Control.Concurrent.SampleVar Control.Exception Control.Monad Control.Monad.Fix Control.Monad.Instances Control.Monad.ST Control.Monad.ST.Lazy Control.Monad.ST.Strict Control.Parallel Control.Parallel.Strategies Data.Array Data.Array.Base Data.Array.Diff Data.Array.IArray Data.Array.IO Data.Array.MArray Data.Array.ST Data.Array.Storable Data.Array.Unboxed Data.Bits Data.Bool Data.ByteString Data.ByteString.Char8 Data.ByteString.Lazy Data.ByteString.Lazy.Char8 Data.ByteString.Base Data.ByteString.Fusion Data.Char Data.Complex Data.Dynamic Data.Either Data.Eq Data.Foldable Data.Fixed Data.Function Data.Generics Data.Generics.Aliases Data.Generics.Basics Data.Generics.Instances Data.Generics.Schemes Data.Generics.Text Data.Generics.Twins Data.Graph Data.HashTable Data.IORef Data.Int Data.IntMap Data.IntSet Data.Ix Data.List Data.Maybe Data.Map Data.Monoid Data.Ord Data.PackedString Data.Ratio Data.STRef Data.STRef.Lazy Data.STRef.Strict Data.Sequence Data.Set Data.String Data.Tree Data.Traversable Data.Tuple Data.Typeable Data.Unique Data.Version Data.Word Debug.Trace Foreign Foreign.C Foreign.C.Error Foreign.C.String Foreign.C.Types Foreign.Concurrent Foreign.ForeignPtr Foreign.Marshal Foreign.Marshal.Alloc Foreign.Marshal.Array Foreign.Marshal.Error Foreign.Marshal.Pool Foreign.Marshal.Utils Foreign.Ptr Foreign.StablePtr Foreign.Storable GHC.Arr GHC.Base GHC.Conc GHC.ConsoleHandler GHC.Dotnet GHC.Dynamic GHC.Enum GHC.Err GHC.Exception GHC.Exts GHC.Float GHC.ForeignPtr GHC.Handle GHC.IO GHC.IOBase GHC.Int GHC.List GHC.Num GHC.PArr GHC.Pack GHC.PrimopWrappers GHC.Ptr GHC.Read GHC.Real GHC.ST GHC.STRef GHC.Show GHC.Stable GHC.Storable GHC.TopHandler GHC.Unicode GHC.Weak GHC.Word Numeric Prelude System.Cmd System.Console.GetOpt System.CPUTime System.Directory System.Directory.Internals System.Environment System.Exit System.IO System.IO.Error System.IO.Unsafe System.Info System.Locale System.Mem System.Mem.StableName System.Mem.Weak System.Posix.Internals System.Posix.Signals System.Posix.Types System.Process System.Process.Internals System.Random System.Time Text.ParserCombinators.ReadP Text.ParserCombinators.ReadPrec Text.PrettyPrint Text.PrettyPrint.HughesPJ Text.Printf Text.Read Text.Read.Lex Text.Show Text.Show.Functions Unsafe.Coerce Data.Array.IO.Internals
ghc-6.7.20070418: panic! (the 'impossible' happened)
  (GHC version 6.7.20070418 for powerpc-unknown-linux):
        ASSERT failed! file stgSyn/CoreToStg.lhs line 946
base:GHC.Base.eqString{v 0h} [lid]

mk/build.mk:

SRC_HC_OPTS     = -H32m -O -fasm -Rghc-timing
GhcStage1HcOpts = -O0 -DDEBUG -W
GhcLibHcOpts    = -O0 -fgenerics
# ^^ not gonna be running complicated things with this... so not -O
GhcLibWays      =
SplitObjs       = NO
GhcBootLibs     = YES

command (after darcs-all get, sh boot, and configure): make stage1

building with ghc-6.6.20070415 (hopefully it's not a bug in that one)

Attachments (1)

ISAACSLOGSHORT.gz (3.8 KB) - added by Isaac Dupree 7 years ago.
output when recompiling base with -O instead

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by Isaac Dupree

output when recompiling base with -O instead

comment:1 Changed 7 years ago by Isaac Dupree

Trying again with -O, oddly, succeeded, and produced quite a lot of output that seems to have some relevant WARNING bits in it (attached).

off-topic: I used make stage1 2>&1 | tee ISAACSLOG to record that, and it seemed to slightly re-order some of the (deleted, rest of the) output, I'm guessing depending on whether it was stderr or stdout, compared to outputting directly to the terminal. Any advice on how to do this in a way that works? (write a haskell program that messes with buffering behavior? ;)

comment:2 Changed 7 years ago by igloo

  • Architecture changed from powerpc to Multiple
  • Milestone set to 6.8

Thanks for the report; also happens for me on Linux/amd64.

The failing assertion is this one:

lookupBinding :: IdEnv HowBound -> Id -> HowBound
lookupBinding env v = case lookupVarEnv env v of
            Just xx -> xx
            Nothing -> ASSERT2( isGlobalId v, ppr v ) ImportBound

The references to eqString are:

eqString :: String -> String -> Bool
eqString []       []       = True
eqString (c1:cs1) (c2:cs2) = c1 == c2 && cs1 `eqString` cs2 
eqString cs1      cs2      = False

{-# RULES "eqString" (==) = eqString #-}
-- eqString also has a BuiltInRule in PrelRules.lhs:
--  eqString (unpackCString# (Lit s1)) (unpackCString# (Lit s2) = s1==s2

and it's got a wired-in unique.

comment:3 Changed 7 years ago by simonpj

  • Resolution set to fixed
  • Status changed from new to closed
  • Test Case set to Compile base with -O0

The crash was caused by the eqString rewrite rule creating a forward reference to GHC.Base.eqString. It's all very specific to the (exactly three) BuiltIn? rules. It's also specific to -O0, becuase with -O we do an occasional "GlomBinds" to re-do the mutual dependencies.

In fact I was surprised to see that RULES fire at all with -O0. I've committed a patch to make -frewrite-rules into a dynamic flag, off with -O0 and on with -O.

That fixes the crash, so I'm closing this bug.

Thanks for pointing it out.

Simon

PS: there are a few other warnings in compiling the base package, but they are harmless. I think.

comment:4 Changed 6 years ago by igloo

  • Milestone changed from 6.8 branch to 6.8.1

comment:5 Changed 6 years ago by simonmar

  • Architecture changed from Multiple to Unknown/Multiple
Note: See TracTickets for help on using tickets.