[GHC] #13380: raiseIO# result looks wrong

GHC ghc-devs at haskell.org
Mon Mar 6 03:01:00 UTC 2017


#13380: raiseIO# result looks wrong
-------------------------------------+-------------------------------------
        Reporter:  dfeuer            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  Other             |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by dfeuer):

 Full test case:

 {{{#!hs
 import Control.Exception

 {-# NOINLINE f #-}
 f :: Int -> Int -> IO Int
 f x y | x>0       = throwIO (userError "What")
       | y>0       = return 1
       | otherwise = return 2

 main = f 2 undefined >>= print
 }}}

 I would expect this to throw the "What" exception, but when it's compiled
 with optimization I get the "undefined" exception. If I had written `throw
 (userError "What")`, that would be acceptable, because we don't make any
 guarantees about which imprecise exception in the imprecise exception set
 we actually throw. But here we are re-ordering evaluation in such a
 fashion as to throw an imprecise exception instead of a precise one, and I
 don't think that's legit.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13380#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list