You also wish to consult the
archive
of the glasgow-haskell-bugs
mailing list...
This is the FEB (Frequently Encountered Bugs) page for the Glasgow Haskell Compiler, suggesting solutions/workarounds to commonly encountered bugs with GHC (versions 0.29 onward).
You may also wish to consult the archive
of the glasgow-haskell-bugs
mailing list...
module Test where data Empty q = Empty (Ord a => q a) q :: (Ord a) => [a] q = [] e :: Empty [] e = Empty qThis bug is fixed in later versions. >>>>>>> 1.41
ghc-0.29 -cpp -fhaskell-1.3 -fglasgow-exts -Onot -c Parser.hs -o Parser.o -osuf o "Parser.hs", line 572, column 14: parse error on input: "->"Edit Parser.hs and change newtype HappyState to data HappyState.
import qualified Prelude f :: Prelude.IO () f = Prelude.print Prelude.TrueWorkaround: use
import qualified Prelude hiding (()) import Prelude (())
*** fptools/ghc/driver/ghc.lprl 1997/09/03 23:48:25 1.35 --- fptools/ghc/driver/ghc.lprl 1997/10/05 20:13:24 *************** *** 2546,2550 **** #---------- what phases are to be run ---------------------------------- ! /^-(no-)?recomp/ && do { $Do_recomp_chkr = ($1 ne '') ? 1 : 0; next arg; }; /^-cpp$/ && do { $Cpp_flag_set = 1; next arg; }; --- 2546,2550 ---- #---------- what phases are to be run ---------------------------------- ! /^-(no-)?recomp/ && do { $Do_recomp_chkr = ($1 eq '') ? 1 : 0; next arg; }; /^-cpp$/ && do { $Cpp_flag_set = 1; next arg; };
This shortcoming only affects people using hsp, users of GHC are not affected.
Warning: discarding polymorphic case: tpl_s2vzand then subsequently dies with
panic! (the `impossible' happened): lookupBindC:no info! for: tpl_s2vzThis is a straightforward bug in simplCore/SimplCore.lhs. Workaround: don't use "!" in data type declarations.
You can easily fix the bug if you have source code: just replace this equation of tidyCoreExpr. The lines marked "!!" are the changed ones.
-- Eliminate polymorphic case, for which we can't generate code just yet tidyCoreExpr (Case scrut (AlgAlts [] (BindDefault deflt_bndr rhs))) | not (typeOkForCase (idType deflt_bndr)) = pprTrace "Warning: discarding polymorphic case:" (ppr PprDebug scrut) $ case scrut of !! Var v -> lookupId v `thenTM` \ v' -> !! extendEnvTM deflt_bndr v' (tidyCoreExpr rhs) other -> tidyCoreExpr (Let (NonRec deflt_bndr scrut) rhs)
Fail: "stranal/SaAbsInt.lhs", line 671: incomplete pattern(s) to match in function "absApply"The fix is to change the call to splitForAllTy to a call to splitForAllTyExpandingDicts in the body of mkWrapper in stranal/WwLib.lhs. Fixed in 2.06.
*** fptools/ghc/driver/ghc-asm.lprl~ Wed Jul 30 14:40:09 1997 --- fptools/ghc/driver/ghc-asm.lprl Wed Aug 27 15:53:33 1997 *************** *** 1149,1154 **** --- 1149,1156 ---- local($exit_patch) = ''; local($call_entry_patch)= ''; local($call_exit_patch) = ''; + local($gc_call_entry_patch)= ''; # Patches before and after calls to Perform_GC_wrapper + local($gc_call_exit_patch) = ''; #OLD: # first, convert calls to *very magic form*: (ToDo: document # for real!) from *************** *** 1238,1253 **** --- 1240,1265 ---- # OK, now we can decide what our patch-up code is going to # be: + + # Note funky ".=" stuff; we're *adding* to these _patch guys if ( $StolenX86Regs <= 2 && ( /32\(\%ebx\)/ || /\%esi/ || /^\tcmps/ ) ) { # R1 (esi) $entry_patch .= "\tmovl \%esi,32(\%ebx)\n"; $exit_patch .= "\tmovl 32(\%ebx),\%esi\n"; + + $gc_call_entry_patch .= "\tmovl \%esi,32(\%ebx)\n"; + $gc_call_exit_patch .= "\tmovl 32(\%ebx),\%esi\n"; + # nothing for call_{entry,exit} because %esi is callee-save } if ( $StolenX86Regs <= 3 && ( /64\(\%ebx\)/ || /\%edi/ || /^\t(scas|cmps)/ ) ) { # SpA (edi) $entry_patch .= "\tmovl \%edi,64(\%ebx)\n"; $exit_patch .= "\tmovl 64(\%ebx),\%edi\n"; + + $gc_call_entry_patch .= "\tmovl \%edi,64(\%ebx)\n"; + $gc_call_exit_patch .= "\tmovl 64(\%ebx),\%edi\n"; + # nothing for call_{entry,exit} because %edi is callee-save } #= if ( $StolenX86Regs <= 4 *************** *** 1265,1271 **** # next, here we go with non-%esp patching! # s/^(\t[a-z])/$entry_patch$1/; # before first instruction ! s/^(\tcall .*\n(\taddl \$\d+,\%esp\n)?)/$call_exit_patch$1$call_entry_patch/g; # _all_ calls # fix _all_ non-local jumps: --- 1277,1290 ---- # next, here we go with non-%esp patching! # s/^(\t[a-z])/$entry_patch$1/; # before first instruction ! ! # Actually, call_entry_patch and call_exit_patch never get set, ! # so let's nuke this one ! # s/^(\tcall .*\n(\taddl \$\d+,\%esp\n)?)/$call_exit_patch$1$call_entry_patch/g; # _all_ calls ! ! # Before calling GC we must set up the exit condition before the call ! # and entry condition when we come back ! s/^(\tcall ${T_DO_GC}\n(\taddl \$\d+,\%esp\n)?)/$gc_call_exit_patch$1$gc_call_entry_patch/g; # _all_ calls # fix _all_ non-local jumps:
After having applied it, you need to remake the contents of ghc/driver, followed by a complete rebuild of the prelude (and hslibs) libraries.
[Thanks to David Barton for reporting a problem that (eventually!) turned out to be caused by the above bug.]ld: Software Generation Utilities (SGU) SunOS/ELF (LK-2.0 (S/I) - versioning) Undefined first referenced symbol in file PrelTup_Z40Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44 Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z4 4Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z44Z41_con_info Galileo6.o ld: fatal: Symbol referencing errors.To solve this you need to add an extra data declaration to ghc/lib/ghc/PrelTup.lhs and rebuild libHS.a. You can't do this from a binary distribution; you have to work from source (at least source for the libraries).
This has been the case with every version of GHC, and we don't have any immediate plans to fix it. Solving it "properly" requires more work than it appears to justify....but please tell us if you think differently!
module Main ( main ) where import Concurrent main :: IO () main = spawner forkIO 1000000 spawner :: (IO () -> IO ()) -> Int -> IO () spawner c 0 = print "done" spawner c n = do { {- print n ; -} c (spawner c (n-1)); return ()}We havn't investigated this yet [mid Aug 97].
src/Readline.lhs:13:warning: Warning: failed to find (optional) interface decl for `Foreign.ts9Tr' panic! (the `impossible' happened): tcLookupTyVar: Foreign.ts9TrWorkaround: compile either the exporting module or the importing module without -O.
"codeGen/ClosureInfo.hi", line 72: undefined type constructor: StgSyn.StgBinderInfo "codeGen/ClosureInfo.hi", line 74: undefined type constructor: CgMonad.CgInfoDownwards "codeGen/ClosureInfo.hi", line 74: undefined type constructor: CgMonad.CgState "codeGen/ClosureInfo.hi", line 74: undefined type constructor: CgMonad.CgState [...and many more like it...]The reason for the break is that the ClosureInfo interface isn't properly closed for the Haskell 1.2 module system to be happy. To fix this, either compile the PprAbsC without optimisations turned on, or apply the following patch:
*** ghc/compiler/ClosureInfo.lhs 1997/07/26 09:49:29 1.23 --- ghc/compiler/ClosureInfo.lhs 1997/08/02 21:27:13 1.24 *************** *** 17,22 **** --- 17,23 ---- mkClosureLFInfo, mkConLFInfo, mkSelectorLFInfo, mkVapLFInfo, mkLFImported, mkLFArgument, mkLFLetNoEscape, + UpdateFlag, closureSize, closureHdrSize, closureNonHdrSize, closureSizeWithoutFixedHdr, *************** *** 27,38 **** layOutStaticNoFVClosure, layOutPhantomClosure, mkVirtHeapOffsets, ! nodeMustPointToIt, getEntryConvention, blackHoleOnEntry, staticClosureRequired, slowFunEntryCodeRequired, funInfoTableRequired, stdVapRequired, noUpdVapRequired, closureId, infoTableLabelFromCI, fastLabelFromCI, closureLabelFromCI, --- 28,42 ---- layOutStaticNoFVClosure, layOutPhantomClosure, mkVirtHeapOffsets, ! nodeMustPointToIt, getEntryConvention, ! SYN_IE(FCode), CgInfoDownwards, CgState, ! blackHoleOnEntry, staticClosureRequired, slowFunEntryCodeRequired, funInfoTableRequired, stdVapRequired, noUpdVapRequired, + StgBinderInfo, closureId, infoTableLabelFromCI, fastLabelFromCI, closureLabelFromCI, *************** *** 40,45 **** --- 44,50 ---- closureLFInfo, closureSMRep, closureUpdReqd, closureSingleEntry, closureSemiTag, closureType, closureReturnsUnboxedType, getStandardFormThunkInfo, + GenStgArg, isToplevClosure, closureKind, closureTypeDescr, -- profiling
[Thanks to Sven Panne for reporting this problem]
[Reported by Bjarte M. Oestvold - thanks!]
instance Foo (->) where ....To fix this, apply the following patch to the 2.05 sources:
*** ghc/compiler/reader/Lex.lhs.~1~ Wed Jul 30 14:35:11 1997 --- ghc/compiler/reader/Lex.lhs Tue Aug 19 19:18:59 1997 **************** *** 664,669 **** --- 664,676 ---- ','# -> lex_tuple module_dot (stepOnBy# buf 2#) _ -> lex_id3 module_dot buf ':'# -> lex_id3 module_dot (incLexeme buf) + '-'# -> + case module_dot of + Nothing -> lex_id3 module_dot buf + Just ghc -> -- this should be "GHC" (current home of (->)) + case lookAhead# buf 1# of + '>'# -> end_lex_id module_dot (ITconid SLIT("->")) (stepOnBy# buf 2#) + _ -> lex_id3 module_dot buf _ -> lex_id3 module_dot buf[Thanks to David Barton for reporting this]
data T = T1 { a :: Int } | { b :: Int }Alas, there's no workaround. Tell us if this is a real nuisance. (It'll be fixed in the next release, of course.)
/tmp/ghc29172.hc:953: fixed or forbidden register was spilled. This may be due to a compiler bug or to impossible asm statements or clauses.The solution is to compile that module with the switch -monly-2-regs added, i.e., do make EXTRA_HC_OPTS=-monly-2-regs ghc/ArrBase.o ; make to continue. For more info as to what went wrong, see Section 7.4.3 of the user's guide.
data X = A {a :: Int} | B {a :: Int}In addition using a record pattern on the left hand side of a binding fails:
let A {a} = x in ...Thanks to Tomasz Cholewo.
signalQSemN :: QSemN -> Int -> IO () signalQSemN (QSemN sem) n = takeMVar sem >>= \ (avail,blocked) -> free (avail+n) blocked >>= \ (avail',blocked') -> putMVar sem (avail',blocked') >> return () where free avail [] = return (avail,[]) free avail ((req,block):blocked) = ! if avail >= req then putMVar block () >> free (avail-req) blocked else free avail blocked >>= \ (avail',blocked') -> return (avail',(req,block):blocked')[Thanks to Meurig Sage.]
Help is at hand though, pick up
ftp://ftp.dcs.gla.ac.uk/pub/haskell/glasgow/working/ghc-2.03-src-MISSING.tar.gzand unpack it on top of the source distribution. If you've got a working a build, typing make all in fptools/ghc/lib/cbits will suffice.
Solution:
Apply the following source patch and recompile the compiler proper: (patch also available from ftp://ftp.dcs.gla.ac.uk/pub/haskell/glasgow/working/ghc-2.03-prof.patch)*** profiling/CostCentre.lhs Mon Mar 10 23:41:44 1997 --- profiling/CostCentre.lhs-CURRENT Mon May 12 10:43:19 1997 *************** *** 389,396 **** do_cc (NormalCC kind mod_name grp_name is_dupd is_caf) = let ! basic_kind = do_caf is_caf ++ do_kind kind in if friendly_sty then ! do_dupd is_dupd (basic_kind ++ ('/': moduleString mod_name) ++ ('/': _UNPK_ grp_name)) else basic_kind --- 389,399 ---- do_cc (NormalCC kind mod_name grp_name is_dupd is_caf) = let ! basic_kind = do_caf is_caf ++ ! moduleString mod_name ++ ! ('/' : _UNPK_ grp_name) ++ ! ('/' : do_kind kind) in if friendly_sty then ! do_dupd is_dupd basic_kind else basic_kind *************** *** 403,411 **** do_kind (DictCC id) = do_id id ++ (if friendly_sty then "/DICT" else "") do_id :: Id -> String ! do_id id ! = if print_as_string ! then getOccString id -- use occ name ! else showId sty id -- we really do --------------- --- 406,415 ---- do_kind (DictCC id) = do_id id ++ (if friendly_sty then "/DICT" else "") + {- + do_id is only applied in a (not print_as_string) context for local ids, + hence using the occurrence name is enough. + -} do_id :: Id -> String ! do_id id = getOccString id --------------- *** reader/Lex.lhs Mon Apr 7 02:00:02 1997 --- reader/Lex.lhs-NEW Mon Apr 28 13:56:53 1997 *************** *** 385,397 **** lexIface (stepOn (stepOverLexeme buf'')) Nothing -> case prefixMatch (stepOn buf) "CAF:" of ! Just buf' -> ! case untilChar# (stepOverLexeme buf') '\"'# of ! buf'' -> ITscc (cafifyCC (mkUserCC (lexemeToFastString buf'') _NIL_ _NIL_)): ! lexIface (stepOn (stepOverLexeme buf'')) Nothing -> ! case untilChar# (stepOn buf) '\"'# of ! buf' -> ITscc (mkUserCC (lexemeToFastString buf') _NIL_ _NIL_): ! lexIface (stepOn (stepOverLexeme buf')) c -> ITunknown [C# c] : lexIface (stepOn buf) --- 385,409 ---- lexIface (stepOn (stepOverLexeme buf'')) Nothing -> + let + match_user_cc buf = + case untilChar# buf '/'# of + buf' -> + let mod_name = lexemeToFastString buf' in + case untilChar# (stepOn (stepOverLexeme buf')) '/'# of + buf'' -> + let grp_name = lexemeToFastString buf'' in + case untilChar# (stepOn (stepOverLexeme buf'')) '\"'# of + buf''' -> + let cc_name = lexemeToFastString buf''' in + (mkUserCC cc_name mod_name grp_name, + stepOn (stepOverLexeme buf''')) + in case prefixMatch (stepOn buf) "CAF:" of ! Just buf' -> ! case match_user_cc (stepOverLexeme buf') of ! (cc, buf'') -> ITscc (cafifyCC cc) : lexIface buf'' Nothing -> ! case match_user_cc (stepOn buf) of ! (cc, buf'') -> ITscc cc : lexIface buf'' c -> ITunknown [C# c] : lexIface (stepOn buf)
ftp://ftp.dcs.gla.ac.uk/pub/haskell/glasgow/ghc-2.03-user-docs.tar.gz
Install this on top of the 2.03 documentation, i.e., in fptools/ghc/docs/users_guide/
foo = do x <- [1..10] return (x+1)elicits the crash:
*** Pattern-matching error within GHC! This is a compiler bug; please report it to glasgow-haskell-bugs@dcs.gla.ac.uk. Fail: "deSugar/DsListComp.lhs", line 118: incomplete pattern(s) to match in function "deListComp"The workaround is to use the list comprehension notation instead. (This tiresome bug was caused by my trying to retain some old list-comprehension code that does deforestation.)
module M (myfoldr) where import Prelude hiding (foldr) myfoldr = Prelude.foldrGHC 2.02 complains that Prelude.foldr isn't in scope. There was an ambiguity in the Haskell Report, which is now cleared up. In general, a hiding clause now does not ever hide qualified names, so Prelude.foldr should be in scope; and this applies to all modules, not just the Prelude.
a :: (Ord f) => f a = b b :: (Ord f) => f b = aelicits the message
tmp.lhs:1: A group of type signatures have mismatched contexts Abf.a :: (PrelBase.Ord f{-aX6-}) => ... Abf.b :: (PrelBase.Ord f{-aX2-}) => ... >>>>>>> 1.41 <<<<<<< ghc-bugs.html Symptom:Workaround: just one type signature for each mutually recursive group.Utter misery when building 0.29 a non-sequential (i.e., profiling, concurrent etc.) prelude from sources:
foo% pwd;make /ghc-BUILDS/0.29/ghc/lib [....] ../../ghc/driver/ghc -c -hi-diffs -dcore-lint -link-chk -iprelude:glaExts -dcore-lint -fshow-pragma-name-errs -fshow-import-specs -fomit-default-instance-methods -cpp -fglasgow-exts -genSPECS -DUSE_FOLDR_BUILD -D__OVERLAPPING_INSTANCES__ -H40m -prelude -fno-implicit-prelude -fomit-reexported-instances -split-objs PIO -ohi prelude/PreludeIO.hi -fno-omit-reexported-instances '-#include"stgio.h"' -hisuf _p.hi -O -prof -GPrelude prelude/PreludeIO_p.hc -odir prelude/PreludeIO -osuf '_p.o' make[1]: *** No rule to make target `/local/grasp_tmp3/hwloidl/sparc-sun-sunos4/./ghc/lib/../../ghc/includes/error.h', needed by `prelude/PreludeIOError_p.hc'. Stop. foo%Solution:
The ghc/lib/Jmake.inc5 in the source distribution contains some links to local Glasgow files. To fix, do `make print_file_lists' and do make again (this will still add some hard-wired paths to the Jmake.inc? files, but at least they're yours now :-)
Empty arrays crashes compacting collector
Symptom:Programs compiled under either the 1.2 compiler (version 0.xx) or the 1.3 compiler (v. 2.xx) that uses empty arrays (i.e., arrays with bounds (a,b) that define an empty range (a>b)) crash and burn with the (default) generational garbage collector, reporting "Segmentation fault" (or the like). Using the two space collector works fine - what gives?
Solution:
The problem is caused by the marking code in the garbage collector assumed that arrays had to be non-empty - which is not the case for arrays. Fix for 0.29 and 2.01 in their next releases - but if you've got the source installed locally, apply the following patch and recompile the RTS:
*** ghc/runtime/storage/SMmark.lhc Mon Aug 5 06:14:38 1996 --- ../../../ghc-0.29/ghc/runtime/storage/SMmark.lhc Tue Jul 23 17:32:21 1996 *************** *** 666,674 **** JUMP_MARK_RETURN; } else { ! INIT_MARK_NODE("MUT ", MUTUPLE_CLOSURE_NoPTRS(Mark)); ! if (MUTUPLE_CLOSURE_NoPTRS(Mark) > 0) ! INIT_MSTACK(MUTUPLE_CLOSURE_PTR); ! else ! JUMP_MARK; } FUNEND; --- 666,671 ---- JUMP_MARK_RETURN; } else { ! INIT_MARK_NODE("MUT ", MUTUPLE_CLOSURE_NoPTRS(Mark)); ! INIT_MSTACK(MUTUPLE_CLOSURE_PTR); } FUNEND;
Building 0.29 hangs at qp2ap
Symptom:On some platforms, when the STARTUP script gets to
ghc/utils/parallel/
, it hangs at...rm -f qp2ap.pl echo "#!"/bin/perl > qp2ap.pl ../../../glafp-utils/msub/msub qp2ap.pl >> qp2ap.pl || ( rm -f qp2ap.pl && exit 1 )Solution:
Drop the spurious first
.pl
in theqp2ap
in the Jmakefile:*** ghc-0.29/ghc/utils/parallel/Jmakefile.~1~ --- ghc-0.29/ghc/utils/parallel/Jmakefile *************** *** 40,46 **** MsubProgramScriptTarget(PerlCmd,gr2java,gr2java.pl,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2jv,gr2jv.bash,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2ap,gr2ap.bash,,) ! MsubProgramScriptTarget(PerlCmd,qp2ap.pl,qp2ap.pl,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2gran,gr2gran.bash,,) MsubProgramScriptTarget(PerlCmd,gr2RTS,gr2RTS.pl,,) --- 40,46 ---- MsubProgramScriptTarget(PerlCmd,gr2java,gr2java.pl,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2jv,gr2jv.bash,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2ap,gr2ap.bash,,) ! MsubProgramScriptTarget(PerlCmd,qp2ap,qp2ap.pl,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2gran,gr2gran.bash,,) MsubProgramScriptTarget(PerlCmd,gr2RTS,gr2RTS.pl,,)
Profiling build `not available' on Solaris
Symptom:When trying the pre-built profiling stuff for
sparc-sun-solaris2
, you may get:% ghc-0.29 -prof Main.hs ghc-0.29: a `profiling' "build" is not available with your GHC setup. (It was not configured for it at your site.)Solution:
Simply edit your driver (ghc-0.29), around about line 207, to read:
%BuildAvail = ('', '-build-normal-defined', '_p', '-build-p-defined', # NB: this line here ...
Stable Pointers problems
Symptom:Programs that use the whizzy stable pointers (references from the outside into the Haskell heap) break during the first major garbage collection. =======
This bug is unlikely to break any programs, especially since 2.02 treats seq as the identity function. (This is a serious, albeit advertised, shortcoming.)
A substitute mkdirhier script is included below, to use it just replace it with the old mkdirhier script:
#!/bin/sh # # create a hierarchy of directories, a mixture between # the glafp-utils/mkdirhier/ and Noah Friedman's mkinstalldirs # errs=0 for f in $*; do parts=`echo ":$f" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` path=""; for p in $parts; do path="$path$p" case "$path" in -* ) path=./$path ;; esac if test ! -d "$path"; then echo "mkdir $path" #1>&2 mkdir "$path" || lasterr=$? if test ! -d "$path"; then errs=$lasterr fi fi path="$path/"; done; done exit $errs # end of story
Two ways to recover from this impassé, either add -lHSrts_{mc,mr} (mc for -concurrent code, mr for -prof -concurrent) to the cmd. line when linking or patch the driver script with the patch available from
ftp://ftp.dcs.gla.ac.uk/pub/haskell/glasgow/working/ghc-2.02-ghc.prl-patchapplying it (patch -p < ghc-2.02-ghc.prl-patch) to the driver script in fptools/bin/<your platform>/ghc-2.02/, and then re-run make in-place or re-install. Patching the driver is the preferred solution.
Thanks to Stefan Westmeier <stefan@stefan.hb.north.de> for reporting the problem.
sed -e 's/FOREIGN OBJ/FOREIGN_OBJ/g' file.hp > file.hp.new mv file.hp.new file.hpSource patch:
*** fptools/ghc/runtime/main/StgStartup.lhc-old Thu Mar 6 20:12:53 1997 --- fptools/ghc/runtime/main/StgStartup.lhc Mon Apr 7 15:02:05 1997 *************** *** 126,128 **** ! ForeignObj_ITBL(ForeignObj_info,ForeignObj_entry,UpdErr,0,INFO_OTHER_TAG,,,const,EF_,ForeignObj_K,"FOREIGN OBJ","ForeignObj"); --- 126,128 ---- ! ForeignObj_ITBL(ForeignObj_info,ForeignObj_entry,UpdErr,0,INFO_OTHER_TAG,,,const,EF_,ForeignObj_K,"FOREIGN_OBJ","ForeignObj"); *************** *** 147,149 **** ! STATIC_ITBL(UnusedSP_info,UnusedSP_entry,UpdErr,0,INFO_OTHER_TAG,0,0,const,IF_,CON_K,"UNUSED STABLE PTR","USP"); --- 147,149 ---- ! STATIC_ITBL(UnusedSP_info,UnusedSP_entry,UpdErr,0,INFO_OTHER_TAG,0,0,const,IF_,CON_K,"UNUSED_STABLE_PTR","USP");
If you don't have a source distribution, the easiest workaround is not to use -O and -prof in conjunction.
*** fptools/ghc/compiler/reader/Lex.lhs-old Tue Mar 18 23:55:12 1997 --- fptools/ghc/compiler/reader/Lex.lhs Mon Apr 7 02:00:02 1997 *************** *** 304,307 **** 's'# -> case prefixMatch (stepOnBy# buf 2#) "cc_" of ! Just buf' -> lex_scc (stepOnUntil (not . isSpace) ! (stepOverLexeme buf')) Nothing -> lex_keyword (stepOnBy# buf 1#) -- drop the '_' and assume --- 304,306 ---- 's'# -> case prefixMatch (stepOnBy# buf 2#) "cc_" of ! Just buf' -> lex_scc (stepOnUntil (not . isSpace) (stepOverLexeme buf')) Nothing -> lex_keyword (stepOnBy# buf 1#) -- drop the '_' and assume *************** *** 376,378 **** buf'' -> ITscc (mkAllCafsCC ({-module-}lexemeToFastString buf'') _NIL_): ! lexIface (stepOverLexeme buf'') Nothing -> --- 375,377 ---- buf'' -> ITscc (mkAllCafsCC ({-module-}lexemeToFastString buf'') _NIL_): ! lexIface (stepOn (stepOverLexeme buf'')) Nothing -> *************** *** 385,387 **** buf'' -> ITscc (mkAllDictsCC (lexemeToFastString buf'') _NIL_ True): ! lexIface (stepOverLexeme buf'') Nothing -> --- 384,386 ---- buf'' -> ITscc (mkAllDictsCC (lexemeToFastString buf'') _NIL_ True): ! lexIface (stepOn (stepOverLexeme buf'')) Nothing -> *************** *** 391,393 **** buf'' -> ITscc (cafifyCC (mkUserCC (lexemeToFastString buf'') _NIL_ _NIL_)): ! lexIface (stepOverLexeme buf'') Nothing -> --- 390,392 ---- buf'' -> ITscc (cafifyCC (mkUserCC (lexemeToFastString buf'') _NIL_ _NIL_)): ! lexIface (stepOn (stepOverLexeme buf'')) Nothing -> *************** *** 395,397 **** buf' -> ITscc (mkUserCC (lexemeToFastString buf') _NIL_ _NIL_): ! lexIface (stepOverLexeme buf') c -> ITunknown [C# c] : lexIface (stepOn buf) --- 394,396 ---- buf' -> ITscc (mkUserCC (lexemeToFastString buf') _NIL_ _NIL_): ! lexIface (stepOn (stepOverLexeme buf')) c -> ITunknown [C# c] : lexIface (stepOn buf) *************** *** 708,709 **** --- 707,709 ---- ,("@_", ITatsign) + ,("letrec_", ITletrec) ,("interface_", ITinterface) *************** *** 751,753 **** ,("let", ITlet) - ,("letrec", ITletrec) ,("deriving", ITderiving) --- 751,752 ---- *** ptools/ghc/compiler/rename/ParseUnfolding.y-old Thu Mar 13 16:55:56 1997 --- fptools/ghc/compiler/rename/ParseUnfolding.y Mon Apr 7 12:30:35 1997 *************** *** 167,169 **** } ! | SCC OPAREN core_expr CPAREN { UfSCC $1 $3 } --- 167,169 ---- } ! | SCC core_expr { UfSCC $1 $2 }
To get around this problem, you will have to pick up a patched version of libgcc.a from
ftp://ftp.dcs.gla.ac.uk/pub/haskell/glasgow/working/from the file libgcc.a.gz See ghc-2.02-cygwin32.README for quick instructions of how and where to install the archive.
-rw-rw-r-- sof 2327819 Mar 28 21:25 /local/ftp/pub/haskell/glasgow/ghc-2.02-conc-i386-unknown-linux.tar.gz -rw-rw-r-- sof 3991335 Mar 28 21:25 /local/ftp/pub/haskell/glasgow/ghc-2.02-i386-unknown-linux.tar.gz -rw-rw-r-- sof 8361827 Mar 26 04:50 /local/ftp/pub/haskell/glasgow/ghc-2.02-prof-i386-unknown-linux.tar.gzthat includes the library plus interface files.
The entries that have too long names are very much on-the-fringe stuff, interface files for one or two of the hslibs/contrib/ numerical codes. If you're bothered, un-tar with the verbose option added and manually rename the interface files where tar trips up. (or, even better, get hold of GNU tar).
To get at maybe in 2.02, you'll have to say
import PrelBase (maybe)Thanks to Alex Ferguson <abf@cs.ucc.ie> for reporting this.
data A = B !Int Char Intto be parsed incorrectly, the Char is parsed as a type constructor applied to Int. Fix is just-around the corner.
module Main(main) where main = print "Hello, world!" --and don't add a newline after the --, the parser complains. Parser fix is in the pipeline, for the moment, the work-around is, Don't Do That Then.
getChan :: Chan a -> IO a getChan (Chan read write) = takeMVar read >>= \ rend -> -- WRONG: takeMVar rend >>= \ res@(ChItem val new_rend) -> readMVar rend >>= \ res@(ChItem val new_rend) -> putMVar read new_rend >> return valThanks to Meurig Sage <meurig@dcs.gla.ac.uk> for reporting the problem and contributing the fix.
*** ghc/compiler/PrimKind.lhs-old 1996/05/15 17:35:06 --- ghc/compiler/PrimKind.lhs 1997/08/07 20:42:19 *************** *** 104,109 **** isFollowableKind ArrayKind = True isFollowableKind ByteArrayKind = True ! -- why is a MallocPtr followable? 4/96 SOF ! --isFollowableKind MallocPtrKind = True isFollowableKind StablePtrKind = False --- 104,113 ---- isFollowableKind ArrayKind = True isFollowableKind ByteArrayKind = True ! -- why is a ForeignObj followable? 4/96 SOF ! -- ! -- A: they're followable because these objects ! -- should be lugged around by the storage manager ! -- (==> we need to generate code that identify them as such) -- 3/97 SOF ! isFollowableKind ForeignObjKind = True isFollowableKind StablePtrKind = False
The output from GHC-0.26 under mips-sgi-irix is not liked by the latest versions of GCC and GAS (i.e., 2.7.2 and 2.6):
% ghc -v hello.hs /usr/tmp/ghc10322.s:44: Error: Can not represent relocation in this object file format /usr/tmp/ghc10322.s:46: Error: Can not represent relocation in this object file format [..]
(or variations thereof). For now, try sticking with an older version of GAS (2.5.2 has been used with success)
Symptom:
Running GHC as it comes out of the binary distribution fails with the message
ld.so.1: hsc: fatal: relocation error: symbol not found: getrusage: referenced in hsc
under Solaris 2.4.
Solution:
Preferably, upgrade to Solaris 2.5 (this problem is specific to Solaris 2.4).
Alternatively, create a dummy definition of getrusage and turn it into a shared object (for use with hsc) and add it to the runtime-system library. Jon Mountjoy gives a recipe for this glorious hack.
Symptom:
After boldly hacking the ghc driver script and setting the GLASGOW_HASKELL_ROOT variable any compilation fails with the message
GLASGOW_HASKELL_ROOT environment variable is set; But can't untangle /local/fp/lib/ghc/2.01/i386-unknown-linux. (Installation error)
Solution:
Don't do it! Set the variables
$InstLibDirGhc $InstDataDirGhc<<<<<<< ghc-bugs.html directly to the directories containing platform-dependent and platform-independent GHC support files, respectively. Using GLASGOW_HASKELL_ROOT is an officially Plain Bad Idea.
Calls to getCPUTime in ghc-2.01 return strange (and very unlikely) results (see bug report).
Solution:
Patched versions of the ghc library for a standard, profiling and concurrent setup are available from the Glasgow FTP server:
ftp://www.dcs.gla.ac.uk/pub/haskell/glasgow/working/libHSghc.a-ghc-2.01-sparc-sun-solaris2 ftp://www.dcs.gla.ac.uk/pub/haskell/glasgow/working/libHSghc_p.a-ghc-2.01-sparc-sun-solaris2 ftp://www.dcs.gla.ac.uk/pub/haskell/glasgow/working/libHSghc_mc.a-ghc-2.01-sparc-sun-solaris2
Symptom:
When compiling a program that has an import PreludeGlaST
with GHC
2.01 and profiling turned on (-prof) an error message like this appears:
ld: /usr/haskell/ghc-2.01/lib/ghc/2.01/sparc-sun-sunos4/libHSrts_p.a(StgStartup.p_o): __regPreludeGlaST: multiply defined
Solution:
Pick one of the following:
setenv LD_OPTIONS "-z muldefs"
in your working environment.
import PreludeGlaST
by import GHCbase
.cvs cy
directly to the directories containing platform-dependent and platform-independent GHC support files, respectively. Using GLASGOW_HASKELL_ROOT is an officially Plain Bad Idea.
Symptom:
When trying the pre-built profiling stuff for sparc-sun-solaris2
,
you may get:
% ghc-0.29 -prof Main.hs ghc-0.29: a `profiling' "build" is not available with your GHC setup. (It was not configured for it at your site.)
Solution:
Simply edit your driver (ghc-0.29), around about line 207, to read:
%BuildAvail = ('', '-build-normal-defined', '_p', '-build-p-defined', # NB: this line here ...
Symptom:
Utter misery when building 0.29 a non-sequential (i.e., profiling, concurrent etc.) prelude from sources:
foo% pwd;make /ghc-BUILDS/0.29/ghc/lib [....] ../../ghc/driver/ghc -c -hi-diffs -dcore-lint -link-chk -iprelude:glaExts -dcore-lint -fshow-pragma-name-errs -fshow-import-specs -fomit-default-instance-methods -cpp -fglasgow-exts -genSPECS -DUSE_FOLDR_BUILD -D__OVERLAPPING_INSTANCES__ -H40m -prelude -fno-implicit-prelude -fomit-reexported-instances -split-objs PIO -ohi prelude/PreludeIO.hi -fno-omit-reexported-instances '-#include"stgio.h"' -hisuf _p.hi -O -prof -GPrelude prelude/PreludeIO_p.hc -odir prelude/PreludeIO -osuf '_p.o' make[1]: *** No rule to make target `/local/grasp_tmp3/hwloidl/sparc-sun-sunos4/./ghc/lib/../../ghc/includes/error.h', needed by `prelude/PreludeIOError_p.hc'. Stop. foo%
Solution:
The ghc/lib/Jmake.inc5 in the source distribution contains some links to local Glasgow files. To fix, do `make print_file_lists' and do make again (this will still add some hard-wired paths to the Jmake.inc? files, but at least they're yours now :-)
Symptom:
Programs compiled under either the 1.2 compiler (version 0.xx) or the 1.3 compiler (v. 2.xx) that uses empty arrays (i.e., arrays with bounds (a,b) that define an empty range (a>b)) crash and burn with the (default) generational garbage collector, reporting "Segmentation fault" (or the like). Using the two space collector works fine - what gives?
Solution:
The problem is caused by the marking code in the garbage collector assumed that arrays had to be non-empty - which is not the case for arrays. Fix for 0.29 and 2.01 in their next releases - but if you've got the source installed locally, apply the following patch and recompile the RTS:
*** ghc/runtime/storage/SMmark.lhc Mon Aug 5 06:14:38 1996 --- ../../../ghc-0.29/ghc/runtime/storage/SMmark.lhc Tue Jul 23 17:32:21 1996 *************** *** 666,674 **** JUMP_MARK_RETURN; } else { ! INIT_MARK_NODE("MUT ", MUTUPLE_CLOSURE_NoPTRS(Mark)); ! if (MUTUPLE_CLOSURE_NoPTRS(Mark) > 0) ! INIT_MSTACK(MUTUPLE_CLOSURE_PTR); ! else ! JUMP_MARK; } FUNEND; --- 666,671 ---- JUMP_MARK_RETURN; } else { ! INIT_MARK_NODE("MUT ", MUTUPLE_CLOSURE_NoPTRS(Mark)); ! INIT_MSTACK(MUTUPLE_CLOSURE_PTR); } FUNEND;
Symptom:
On some platforms, when the STARTUP script gets to ghc/utils/parallel/
,
it hangs at...
rm -f qp2ap.pl echo "#!"/bin/perl > qp2ap.pl ../../../glafp-utils/msub/msub qp2ap.pl >> qp2ap.pl || ( rm -f qp2ap.pl && exit 1 )
Solution:
Drop the spurious first .pl
in the qp2ap
in the Jmakefile:
*** ghc-0.29/ghc/utils/parallel/Jmakefile.~1~ --- ghc-0.29/ghc/utils/parallel/Jmakefile *************** *** 40,46 **** MsubProgramScriptTarget(PerlCmd,gr2java,gr2java.pl,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2jv,gr2jv.bash,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2ap,gr2ap.bash,,) ! MsubProgramScriptTarget(PerlCmd,qp2ap.pl,qp2ap.pl,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2gran,gr2gran.bash,,) MsubProgramScriptTarget(PerlCmd,gr2RTS,gr2RTS.pl,,) --- 40,46 ---- MsubProgramScriptTarget(PerlCmd,gr2java,gr2java.pl,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2jv,gr2jv.bash,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2ap,gr2ap.bash,,) ! MsubProgramScriptTarget(PerlCmd,qp2ap,qp2ap.pl,,) MsubProgramScriptTarget(/usr/local/bin/bash,gr2gran,gr2gran.bash,,) MsubProgramScriptTarget(PerlCmd,gr2RTS,gr2RTS.pl,,)
>>>>>>> 1.41 <<<<<<< ghc-bugs.html Last modified: Wed Nov 6 00:15:15 1996 Stardate: [-31]8379.28 ======= Last modified: Fri 10 Oct 18:39 BST 1997 by sof@dcs.gla.ac.uk >>>>>>> 1.41