[GHC] #10538: Simpilifier produces empty case in core, segfaults at runtime.
GHC
ghc-devs at haskell.org
Thu Jun 18 13:14:47 UTC 2015
#10538: Simpilifier produces empty case in core, segfaults at runtime.
-------------------------------------+-------------------------------------
Reporter: sopvop | Owner: bgamari
Type: bug | Status: new
Priority: high | Milestone: 7.10.2
Component: Compiler | Version: 7.10.2-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime crash | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones <simonpj@…>):
In [changeset:"023a0ba938b69bbb89cb2ce48a07459b07783391/ghc"]:
{{{
#!CommitTicketReference repository="ghc"
revision="023a0ba938b69bbb89cb2ce48a07459b07783391"
Care with impossible-cons in combineIdenticalAlts
This was a nasty, long-standing bug exposed in Trac #10538.
Symptoms were that we had an empty case
case (x :: Either a) of {}
Core Lint correctly picked this bogus code up.
Here is what happened
* In SimplUtils.prepareAlts, we call
filterAlts
then
combineIdenticalAlts
* We had case x of { Left _ -> e1; Right _ -> e1 }
* filterAlts did nothing, but correctly retuned imposs_deflt_cons
saying that 'x' cannot be {Left, Right} in the DEFAULT branch,
if any (there isn't one.)
* combineIdentialAlts correctly combines the identical alts, to give
case x of { DEFAULT -> e1 }
* BUT combineIdenticalAlts did no adjust imposs_deft_cons
* Result: when compiling e1 we did so in the belief that 'x'
could not be {Left,Right}. Disaster.
Easily fixed.
(It is hard to trigger; I can't construct a simple test case.)
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10538#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list