[GHC] #14290: Strictness bug with existential contexts on data constructors
#14290: Strictness bug with existential contexts on data constructors -------------------------------------+------------------------------------- Reporter: simonmar | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Incorrect result Unknown/Multiple | at runtime Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The following: {{{ {-# LANGUAGE ExistentialQuantification #-} module Main (main) where main :: IO () main = r `seq` return () r :: Rec r = Rec{ a = error "xxx", b = 3, c = True } class C t instance C Bool data Rec = forall t. C t => Rec { a :: () , b :: !Int , c :: t } }}} Fails with `error "xxx"`, when it should succeed. The problem is that the strictness signature for the data con wrapper doesn't take into account the dictionary fields. I have a patch which I'll upload to Phabricator shortly... -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14290> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14290: Strictness bug with existential contexts on data constructors -------------------------------------+------------------------------------- Reporter: simonmar | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by simonmar: Old description:
The following:
{{{ {-# LANGUAGE ExistentialQuantification #-} module Main (main) where
main :: IO () main = r `seq` return ()
r :: Rec r = Rec{ a = error "xxx", b = 3, c = True }
class C t instance C Bool
data Rec = forall t. C t => Rec { a :: () , b :: !Int , c :: t } }}}
Fails with `error "xxx"`, when it should succeed. The problem is that the strictness signature for the data con wrapper doesn't take into account the dictionary fields.
I have a patch which I'll upload to Phabricator shortly...
New description: The following: {{{ {-# LANGUAGE ExistentialQuantification #-} module Main (main) where main :: IO () main = r `seq` return () r :: Rec r = Rec{ a = error "xxx", b = 3, c = True } class C t instance C Bool data Rec = forall t. C t => Rec { a :: () , b :: !Int , c :: t } }}} Should succesed, but fails with `error "xxx"` (but only when compiled with `-O`). The problem is that the strictness signature for the data con wrapper doesn't take into account the dictionary fields. I have a patch which I'll upload to Phabricator shortly... -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14290#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14290: Strictness bug with existential contexts on data constructors -------------------------------------+------------------------------------- Reporter: simonmar | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by simonmar: Old description:
The following:
{{{ {-# LANGUAGE ExistentialQuantification #-} module Main (main) where
main :: IO () main = r `seq` return ()
r :: Rec r = Rec{ a = error "xxx", b = 3, c = True }
class C t instance C Bool
data Rec = forall t. C t => Rec { a :: () , b :: !Int , c :: t } }}}
Should succesed, but fails with `error "xxx"` (but only when compiled with `-O`). The problem is that the strictness signature for the data con wrapper doesn't take into account the dictionary fields.
I have a patch which I'll upload to Phabricator shortly...
New description: The following: {{{ {-# LANGUAGE ExistentialQuantification #-} module Main (main) where main :: IO () main = r `seq` return () r :: Rec r = Rec{ a = error "xxx", b = 3, c = True } class C t instance C Bool data Rec = forall t. C t => Rec { a :: () , b :: !Int , c :: t } }}} Should succeed, but fails with `error "xxx"` (but only when compiled with `-O`). The problem is that the strictness signature for the data con wrapper doesn't take into account the dictionary fields. I have a patch which I'll upload to Phabricator shortly... -- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14290#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14290: Strictness bug with existential contexts on data constructors -------------------------------------+------------------------------------- Reporter: simonmar | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4040 Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonmar): * differential: => Phab:D4040 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14290#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14290: Strictness bug with existential contexts on data constructors -------------------------------------+------------------------------------- Reporter: simonmar | Owner: (none) Type: bug | Status: new Priority: highest | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4040 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"5935acdb1302263011c2023d5e7f4ec496c972c0/ghc" 5935acd/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="5935acdb1302263011c2023d5e7f4ec496c972c0" mkDataConRep: fix bug in strictness signature (#14290) The strictness signature for a data con wrapper wasn't including any dictionary arguments, which meant that bangs on the fields of a constructor with an existential context would be moved to the wrong fields. See T14290 for an example. Test Plan: * New test T14290 * validate Reviewers: simonpj, niteria, austin, bgamari, erikd Reviewed By: simonpj, bgamari Subscribers: rwbarton, thomie GHC Trac Issues: #14290 Differential Revision: https://phabricator.haskell.org/D4040 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14290#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#14290: Strictness bug with existential contexts on data constructors -------------------------------------+------------------------------------- Reporter: simonmar | Owner: (none) Type: bug | Status: closed Priority: highest | Milestone: 8.2.2 Component: Compiler | Version: 8.2.1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D4040 Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed Comment: Merged to `ghc-8.2` as a0671e2de97c5801bfba4b12f16e498492681bc1. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14290#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC