Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler bug involving MVar, Integer, and tuples #412

Open
blynn opened this issue Sep 24, 2017 · 0 comments
Open

compiler bug involving MVar, Integer, and tuples #412

blynn opened this issue Sep 24, 2017 · 0 comments

Comments

@blynn
Copy link

blynn commented Sep 24, 2017

The following generates JavaScript that crashes due to an Uncaught ReferenceError involving what seems to be a generated symbol (e.g. "_l2"). It succeeds if compiled with --ddisable-js-opts.

import Control.Concurrent.MVar
import Data.Array

main :: IO ()
main = do
  let r = ((0,0), (7,7))
  mv <- newEmptyMVar
  putMVar mv True
  b <- takeMVar mv
  if b then do
    putStrLn "crashes here"
    putStrLn $ show [inRange r (0 + x, 7 + y) | x <- [-1, 1], y <- [-1, 1]]
    putStrLn "...unless compiled with --ddisable-js-opts"
  else undefined

I tried finding a smaller example, but I found the crash disappeared if:

  • The Integer values are declared as Ints instead: (0 :: Int,0 :: Int), (7,7))
  • The MVar is removed
  • The 2-dimensional bounds are replaced with a 1-dimensional bound, e.g. (0, 7)

Hopefully the above is enough to go on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant