[GHC] #10824: Let-bindings of kind # are processed backwards

#10824: Let-bindings of kind # are processed backwards -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Revisions: | -------------------------------------+------------------------------------- Consider this module: {{{ {-# LANGUAGE MagicHash #-} import GHC.Exts main = do let x = error "bar" :: Int# y = error "foo" :: Int# print (I# x + I# y) }}} When you run this, you will get the error "foo" and not the error "bar". This is backwards! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10824 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10824: Strict let-bindings are processed backwards -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Description changed by ezyang: Old description:
Consider this module:
{{{ {-# LANGUAGE MagicHash #-} import GHC.Exts main = do let x = error "bar" :: Int# y = error "foo" :: Int# print (I# x + I# y) }}}
When you run this, you will get the error "foo" and not the error "bar". This is backwards!
New description: Consider this module: {{{ main = do let !x = error "bar" !y = error "foo" print (x + y) }}} or this analogous module: {{{ {-# LANGUAGE MagicHash #-} import GHC.Exts main = do let x = error "bar" :: Int# y = error "foo" :: Int# print (I# x + I# y) }}} When you run these, you will get the error "foo" and not the error "bar". This is backwards! -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10824#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10824: Strict let-bindings are processed backwards -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by simonpj): I don't think we should offer any guarantee for what happens in this case. Our [http://research.microsoft.com/en-us/um/people/simonpj/papers /imprecise-exn.htm imprecise-exceptions paper] says why. I'm not against making the by-default behaviour a bit more intuitive but I don't think we should specify an evaluation order. So I suggest "invalid" here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10824#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10824: Strict let-bindings are processed backwards -------------------------------------+------------------------------------- Reporter: ezyang | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Resolution: invalid | 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 ezyang): * status: new => closed * resolution: => invalid -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10824#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC