[GHC] #7453: unsafe coerce without extensions
GHC
cvs-ghc at haskell.org
Mon Dec 3 18:01:08 CET 2012
#7453: unsafe coerce without extensions
------------------------------------------+---------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type checker) | Version: 7.6.1
Resolution: | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: GHC accepts invalid program | Difficulty: Unknown
Testcase: T7453 | Blockedby:
Blocking: | Related:
------------------------------------------+---------------------------------
Comment(by simonpj):
Here is a fix for the 7.6 branch
{{{
commit b637a24dbb471d99887e5544037a2abe10af26ee
Author: Simon Peyton Jones <simonpj at microsoft.com>
Date: Mon Dec 3 16:57:30 2012 +0000
Fix Trac #7453 on the 7.6 branch
This patch fixes a quite egregious bug. runTcS was intialising
the 'untouchables' to NoUntouchables, which is quite wrong for
the invocation in TcSimplify.simplifyInfer. Result: missed
skolem-escape check and seg-fault city.
All this is done differently, and better, in HEAD, so this
patch is needed only on the branch.
>---------------------------------------------------------------
compiler/typecheck/TcSMonad.lhs | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/compiler/typecheck/TcSMonad.lhs
b/compiler/typecheck/TcSMonad.lhs index eaaa8f6..8adb1d5 100644
--- a/compiler/typecheck/TcSMonad.lhs
+++ b/compiler/typecheck/TcSMonad.lhs
@@ -935,6 +935,15 @@ runTcSWithEvBinds ev_binds_var tcs
; inert_var <- TcM.newTcRef is
; wl_var <- TcM.newTcRef wl
+ -- The "low end" of the untouchable range should come from the
+ -- ambient tcl_untch; the high end is the highest allocated to
+ -- date. 'untouch' used (in 7.6.1, entirely wrongly) to be
+ -- set to NoUntouchables, causing #7453.
+ -- All this is done much better in 7.8.
+ ; tc_lenv <- TcM.getLclEnv
+ ; tcm_high <- TcM.readTcRef (tcl_meta tc_lenv)
+ ; let untouch = TouchableRange tcm_low tcm_high
+ tcm_low = tcl_untch tc_lenv
; let env = TcSEnv { tcs_ev_binds = ev_binds_var
, tcs_ty_binds = ty_binds_var
, tcs_untch = (untouch, emptyVarSet) -- No
Tcs untouchables yet
@@ -960,7 +969,6 @@ runTcSWithEvBinds ev_binds_var tcs
; return res }
where
do_unification (tv,ty) = TcM.writeMetaTyVar tv ty
- untouch = NoUntouchables
is = emptyInert
wl = emptyWorkList
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/7453#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the Glasgow-haskell-bugs
mailing list