
#10414: Buggy behavior with threaded runtime (-N1 working, -N2 getting into
<<loop>>)
-------------------------------------+-------------------------------------
Reporter: exio4 | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Incorrect result | Unknown/Multiple
at runtime | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by rwbarton):
I took a look at the generated STG for par2.hs before and after the
cardinality analysis commit. Before, there are no `\s` thunks at all.
After, there are two. One is in
{{{
Main.main_go [Occ=LoopBreaker]
:: [[GHC.Types.Char]] -> [GHC.Types.Char]
[GblId,
Arity=1,
Caf=NoCafRefs,
Str=DmdType ,
Unf=OtherCon []] =
\r srt:SRT:[] [ds_s1nu]
case ds_s1nu of _ {
[] -> [] [];
: y_s1ny [Occ=Once] ys_s1nz [Occ=Once] ->
let {
sat_s1pj [Occ=Once, Dmd=]
Main.main_go =
\ (ds_XrA :: [[GHC.Types.Char]]) ->
case ds_XrA of _ {
[] -> GHC.Types.[] @ GHC.Types.Char;
: y_arg ys_arh ->
GHC.Base.++ @ GHC.Types.Char y_arg (Main.main_go ys_arh)
}
}}}
which presumably comes from the use of `concat` in `layer`. This happens
even when I build the program with `-fkill-absence -fkill-one-shot`. Could
that be because base was built with cardinality analysis enabled? I don't
entirely see how, but I can try rebuilding the libraries with `-fkill-
absence -fkill-one-shot`.
Anyways I guess the main question, which I'm not sure how to answer, is
whether the fact that this thunk is marked as single-entry is correct.
The other single-entry thunk is, I think, very similar and arises from
`concatMap`:
{{{
{- note
$wlayer_r1m6
:: (GHC.Types.Char -> GHC.Base.String)
-> GHC.Prim.Char# -> GHC.Base.String
[GblId, Caf=NoCafRefs, Str=DmdType, Unf=OtherCon []]
w3_r1ma :: GHC.Types.Char -> GHC.Base.String
[GblId, Arity=1, Str=DmdType, Unf=OtherCon []]
-}
Main.main_go2 [Occ=LoopBreaker]
:: [GHC.Types.Char] -> [GHC.Types.Char]
[GblId, Arity=1, Str=DmdType , Unf=OtherCon []] =
\r srt:SRT:[(r8, Main.main_go2), (r1m6, $wlayer_r1m6),
(r1ma, w3_r1ma)] [ds_s1oh]
case ds_s1oh of _ {
[] -> [] [];
: y_s1ol [Occ=Once!] ys_s1oq [Occ=Once] ->
case y_s1ol of _ {
GHC.Types.C# ww1_s1oo [Occ=Once] ->
let {
sat_s1pv [Occ=Once, Dmd=