[GHC] #14171: STM causes program to suddenly exit

GHC ghc-devs at haskell.org
Sun Sep 3 00:09:09 UTC 2017


#14171: STM causes program to suddenly exit
----------------------------------+----------------------------------------
        Reporter:  MichaelBurge   |                Owner:  bgamari
            Type:  bug            |               Status:  new
        Priority:  highest        |            Milestone:
       Component:  libraries/stm  |              Version:  8.2.1
      Resolution:                 |             Keywords:
Operating System:  Linux          |         Architecture:  Unknown/Multiple
 Type of failure:  Runtime crash  |            Test Case:
      Blocked By:                 |             Blocking:
 Related Tickets:                 |  Differential Rev(s):
       Wiki Page:                 |
----------------------------------+----------------------------------------

Comment (by bgamari):

 I think I see what is going on here: `postProcessDmdResult` looks only for
 `ThrowsExn` `DmdResult` when computing termination,
 {{{#!hs
 postProcessDmdResult :: Str () -> DmdResult -> DmdResult
 postProcessDmdResult Lazy           _         = topRes
 postProcessDmdResult (Str ExnStr _) ThrowsExn = topRes  -- Key point!
 postProcessDmdResult _              res       = res
 }}}
 However, the demand being analysed here is `Diverges`, not `ThrowsExn`
 (again, due to the use of `retry#`). One "solution" here is,
 {{{#!patch
 diff --git a/compiler/basicTypes/Demand.hs b/compiler/basicTypes/Demand.hs
 index dfff0a2c92..f56d28c4a9 100644
 --- a/compiler/basicTypes/Demand.hs
 +++ b/compiler/basicTypes/Demand.hs
 @@ -1440,6 +1441,7 @@ postProcessDmdType du@(JD { sd = ss }) (DmdType fv _
 res_ty)
  postProcessDmdResult :: Str () -> DmdResult -> DmdResult
  postProcessDmdResult Lazy           _         = topRes
  postProcessDmdResult (Str ExnStr _) ThrowsExn = topRes  -- Key point!
 +postProcessDmdResult (Str ExnStr _) Diverges  = topRes  -- Key point!
  postProcessDmdResult _              res       = res

 }}}
 This allows the program malfunctioning in this ticket to run as expected.
 However, it's not clear to me that this is correct: the
 `ThrowsExn`/`Diverges` distinction isn't defined in the original demand
 analysis paper nor any of the later papers that I have found.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14171#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list