Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

catch _|_ breaks at -O1
Discovered on xmonad-0.12 test failure. Happens on today's -HEAD and ghc-8.0.1-rc1,-rc2 Short example is (needs only base): ```hs -- cat F.hs module F where import qualified Control.Exception as C import System.IO.Unsafe import qualified Data.List as L abort :: String -> a abort x = error $ "xmonad: StackSet: " ++ x prop_abort x = unsafePerformIO $ C.catch (abort "fail") (\(C.SomeException e) -> return $ "xmonad: StackSet: fail" `L.isPrefixOf` show e ) where _ = x :: Int ``` Session 1 \[ok\]: ``` $ ghci F.hs GHCi, version 8.0.0.20160204: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling F ( F.hs, interpreted ) Ok, modules loaded: F. *F> prop_abort 1 True ``` Session 2 \[fails\]: ``` $ ghci -O1 -fobject-code F.hs GHCi, version 8.0.0.20160204: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling F ( F.hs, F.o ) Ok, modules loaded: F. Prelude F> prop_abort 1 *** Exception: xmonad: StackSet: fail CallStack (from HasCallStack): error, called at F.hs:9:11 in main:F ``` I would expect exception to be caught on both cases. Is it unreasonable expectation in light of unsafePerformIO? <details><summary>Trac metadata</summary> | Trac field | Value | | ---------------------- | ------------ | | Version | 8.0.1-rc2 | | Type | Bug | | TypeOfFailure | OtherFailure | | Priority | normal | | Resolution | Unresolved | | Component | Compiler | | Test case | | | Differential revisions | | | BlockedBy | | | Related | | | Blocking | | | CC | simonpj | | Operating system | | | Architecture | | </details> <!-- {"blocked_by":[],"summary":"catch under unsafePerformIO breaks on -O1","status":"New","operating_system":"","component":"Compiler","related":[],"milestone":"","resolution":"Unresolved","owner":{"tag":"Unowned"},"version":"8.0.1-rc2","keywords":[],"differentials":[],"test_case":"","architecture":"","cc":["simonpj"],"type":"Bug","description":"Discovered on xmonad-0.12 test failure.\r\nHappens on today's -HEAD and ghc-8.0.1-rc1,-rc2\r\n\r\nShort example is (needs only base):\r\n{{{#!hs\r\n-- cat F.hs\r\nmodule F where\r\n\r\nimport qualified Control.Exception as C\r\nimport System.IO.Unsafe\r\nimport qualified Data.List as L\r\n\r\nabort :: String -> a\r\nabort x = error $ \"xmonad: StackSet: \" ++ x\r\n\r\nprop_abort x = unsafePerformIO $ C.catch (abort \"fail\")\r\n (\\(C.SomeException e) ->\r\n return $ \"xmonad: StackSet: fail\" `L.isPrefixOf` show e )\r\n where\r\n _ = x :: Int\r\n}}}\r\n\r\nSession 1 [ok]:\r\n{{{\r\n$ ghci F.hs\r\n\r\nGHCi, version 8.0.0.20160204: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling F ( F.hs, interpreted )\r\nOk, modules loaded: F.\r\n\r\n*F> prop_abort 1\r\nTrue\r\n}}}\r\n\r\nSession 2 [fails]:\r\n{{{\r\n$ ghci -O1 -fobject-code F.hs\r\n\r\nGHCi, version 8.0.0.20160204: http://www.haskell.org/ghc/ :? for help\r\n[1 of 1] Compiling F ( F.hs, F.o )\r\nOk, modules loaded: F.\r\n\r\nPrelude F> prop_abort 1\r\n*** Exception: xmonad: StackSet: fail\r\nCallStack (from HasCallStack):\r\n error, called at F.hs:9:11 in main:F\r\n}}}\r\n\r\nI would expect exception to be caught on both cases.\r\nIs it unreasonable expectation in light of unsafePerformIO?\r\n","type_of_failure":"OtherFailure","blocking":[]} -->
issue