[GHC] #11396: deriving Ix with custom ifThenElse causes "Bad call to tagToEnum#"
#11396: deriving Ix with custom ifThenElse causes "Bad call to tagToEnum#" -------------------------------------+------------------------------------- Reporter: Lemming | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1-rc1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{ $ cat IfThenElseIx.hs {-# LANGUAGE RebindableSyntax #-} module IfThenElseIx where import Data.Ix (Ix, ) import Prelude ifThenElse :: Bool -> a -> a -> a ifThenElse True x _ = x ifThenElse False _ x = x data T = A | B deriving (Eq, Ord, Ix) $ ghci-8.0.0.20160109 IfThenElseIx.hs GHCi, version 8.0.0.20160109: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling IfThenElseIx ( IfThenElseIx.hs, interpreted ) IfThenElseIx.hs:13:35: error: • Bad call to tagToEnum# at type a_a2ky Specify the type by giving a type signature e.g. (tagToEnum# x) :: Bool • In the second argument of ‘ifThenElse’, namely ‘(GHC.Prim.tagToEnum# (c# GHC.Prim.<=# b#))’ In the expression: if (GHC.Prim.tagToEnum# (c# GHC.Prim.>=# a#)) then (GHC.Prim.tagToEnum# (c# GHC.Prim.<=# b#)) else False In a case alternative: c# -> if (GHC.Prim.tagToEnum# (c# GHC.Prim.>=# a#)) then (GHC.Prim.tagToEnum# (c# GHC.Prim.<=# b#)) else False When typechecking the code for ‘GHC.Arr.inRange’ in a derived instance for ‘Ix T’: To see the code I am typechecking, use -ddump-deriv Failed, modules loaded: none. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11396> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11396: deriving Ix with custom ifThenElse causes "Bad call to tagToEnum#" -------------------------------------+------------------------------------- Reporter: Lemming | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by thomie): * priority: normal => highest * milestone: => 8.0.1 Comment: Regression. Reproducible with HEAD. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11396#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11396: deriving Ix with custom ifThenElse causes "Bad call to tagToEnum#" -------------------------------------+------------------------------------- Reporter: Lemming | Owner: Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): This is a regression relative to 7.10.3. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11396#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11396: deriving Ix with custom ifThenElse causes "Bad call to tagToEnum#" -------------------------------------+------------------------------------- Reporter: Lemming | Owner: bgamari Type: bug | Status: new Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * owner: => bgamari Comment: This comes from the `inRange` case generated for `Ix`. We decided to use guards instead. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11396#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11396: deriving Ix with custom ifThenElse causes "Bad call to tagToEnum#" -------------------------------------+------------------------------------- Reporter: Lemming | Owner: bgamari Type: bug | Status: patch Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1797 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => patch * differential: => Phab:D1797 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11396#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11396: deriving Ix with custom ifThenElse causes "Bad call to tagToEnum#" -------------------------------------+------------------------------------- Reporter: Lemming | Owner: bgamari Type: bug | Status: patch Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1797 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"5cce09543db827e662539523ffff4513deb92777/ghc" 5cce0954/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="5cce09543db827e662539523ffff4513deb92777" Use (&&) instead of `if` in Ix derivation We were previously using `if` in the derivation of `Ix` instances. This interacts badly with RebindableSyntax as the typechecker doesn't infer the type of the argument we give to `tagToEnum#`. Previously we produced, `if (ch >= ah) then (ch <= bh) else False`. We now produce `(ch >= ah) && (ch <= bh)` Fixes #11396. Test Plan: Validate Reviewers: austin, simonpj Reviewed By: simonpj Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1797 GHC Trac Issues: #11396 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11396#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11396: deriving Ix with custom ifThenElse causes "Bad call to tagToEnum#" -------------------------------------+------------------------------------- Reporter: Lemming | Owner: bgamari Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1797 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: patch => closed * resolution: => fixed Comment: Merged to `ghc-8.0` as 82efc3e6f7664d7e744c533dea62ab61786486af. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11396#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#11396: deriving Ix with custom ifThenElse causes "Bad call to tagToEnum#" -------------------------------------+------------------------------------- Reporter: Lemming | Owner: bgamari Type: bug | Status: closed Priority: highest | Milestone: 8.0.1 Component: Compiler | Version: 8.0.1-rc1 Resolution: fixed | Keywords: deriving Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D1797 Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * keywords: => deriving -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11396#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC