[GHC] #11172: Turning on optimisations produces SEGFAULT or Impossible case alternative

GHC ghc-devs at haskell.org
Wed Jan 20 20:29:54 UTC 2016


#11172: Turning on optimisations produces SEGFAULT or Impossible case alternative
-------------------------------------+-------------------------------------
        Reporter:  nh2               |                Owner:  bgamari
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Runtime crash     |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by jscholl):

 Ok, I think the segfault boils down to: Somewhere something expects to
 only recieve a {{{Right}}} constructor and then gets passed a {{{Left}}}.
 Hence the pointer is tagged with a 1 but should be tagged with a 2, we add
 6 to access the contents and read the wrong memory.

 I think this could be related to the previous bug (only that this time the
 simplifier removes the impossible case alternative, so we do not enter an
 exception but this segfault in the case).

 To test this I first tried to run the example with ghc-8.0-rc1, but
 somehow it does not typecheck... I just get

 {{{
 [1 of 2] Compiling Module           ( Module.hs, Module.o )

 Module.hs:28:38: error:
     • Couldn't match kind ‘GHC.Prim.Any’ with ‘*’
       When matching the kind of ‘Either [Char]’
     • In the third argument of ‘runParser’, namely ‘onError’
       In the expression: runParser (m v) [] onError Right
       In an equation for ‘parseEither’:
           parseEither m v
             = runParser (m v) [] onError Right
             where
                 onError _ = Left "Error in "
 }}}

 ghc-7.10.3 works fine, though. So maybe this is another regression? I just
 though the fix would work best with a current ghc.

 Anyway, here's the code. It's not as short as last time, sadly.

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


More information about the ghc-tickets mailing list