Jon Mountjoy writes:
> Hello People,
>
> Here is another interface-parse file error. I don't know if it is fixed due to my
> other bug report or not. Running Solaris ghc-2.02.
>
> Compile Dt.hs with: ghc-2.02 -fglasgow-exts -prof -auto -c -O Dt.hs
> Compile Main.lhs with: ghc-2.02 -fglasgow-exts -prof -auto -c -O Main.lhs
>
> If I take the -O out when compiling Dt.hs then it works fine.
>
[...compiler panic dump deleted ...]
Thanks muchly for the report - a bug indeed in the interface file
lexer (plus another one in the interface file parser that was
uncovered while fixing the former :-) The simplest workaround (as you
suggest) is not to use -O and -prof together, but this might not be
a very satisfactory solution. I've enclosed the source patches for
those who want to fix it properly.
BTW, we plan to bring out a patched source-only release fairly soon
(within week(s)) that tidies up and fixes reported 2.02 bugs. So if
anyone is running into trouble with 2.02 elsewhere - please report it
so that we can hopefully get the fixes in.
>
> PS. While I am at it, please look at popST and tell me why the good is
> good and the bad is bad :-) I am not sure whether this is still the case
> with ghc-2.02 but it was with ghc-2.00
>
> -- I get a very very bad space behaviour with the Bad code, and much better
> -- with the good code. Any explanations? I guess the let version isn't as
> -- strict but why does it hold on?
>
> popST :: R Int
> popST = do
>
> {- Good -}
> (AST (SE a:t)) <- getST
> setST (AST t)
> return a
>
> {- Bad
> (AST h) <- getST
> let (SE a) = head h
> setST (AST (tail h))
> return (a)
> -}
>
Hard to say by just looking at `popST' - my initial guess would be
that a fair chunk of the stack elements are not being prodded, hence
the build up of closures. Being strict isn't always a Bad Thing; I
wish there were good ways of catching these kinds of bugs. (if
anyone's got a good, bullet-proof methodology for catching space
leaks, please share!)
--Sigbjorn
*** 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 }