Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,348
    • Issues 5,348
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 564
    • Merge requests 564
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #15262
Closed
Open
Issue created Jun 11, 2018 by howtonotwin@howtonotwinReporter

GHC and iserv cannot agree on what an Integer is; insanity ensues

Tested off ghc-8.6.1-alpha1, running on macOS 10.13.5.

  1. Compile a GHC that uses integer-gmp.

  2. Compile a GHC that uses integer-simple.

  3. Make Main.hs:

    {-# LANGUAGE TemplateHaskell #-}
    main = print $([e| 0 |])
  4. Try to compile the file with integer-gmp ghc and integer-simple ghc-iserv.

    • Expected behavior: (compiles fine and executable prints 0) or (outputs to-the-point error message)

    • Actual:

      [1 of 1] Compiling Main             ( Main.hs, Main.o )
      
      Main.hs:2:14: error:
          • Exception when trying to run compile-time code:
              ghc: ghc-iserv terminated (-11)
            Code: [| 0 |]
          • In the untyped splice: $([| 0 |])
        |
      2 | main = print $([e| 0 |])
        |              ^^^^^^^^^^^
  5. Try to compile the file with integer-simple ghc and integer-gmp ghc-iserv.

    • Expected behavior: (compiles fine and executable prints 0) or (outputs to-the-point error message)

    • Actual:

      [1 of 1] Compiling Main             ( Main.hs, Main.o )
      
      Main.hs:2:14: error:
          • Exception when trying to run compile-time code:
              heap overflow
            Code: [| 0 |]
          • In the untyped splice: $([| 0 |])
        |
      2 | main = print $([e| 0 |])
        |              ^^^^^^^^^^^

For more fun, replace the 0 with a 1. gmp ghc + simple iserv continues to explode. This is better than simple ghc + gmp iserv:

$ ./Main
283468057265
$ ./Main
283468057265
$ $simple_ghc -fexternal-interpreter -pgmi=$gmp_iserv Main.hs # again
# ...
$ ./Main
283468057105

Absolutely delicious. There is a similar situation for fractional literals.

It would be nice if there were at least a warning for situations like this.

Edited Apr 25, 2019 by howtonotwin
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking