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

GHC panic when compiling examples #19

Open
torgeirsh opened this issue Oct 28, 2017 · 9 comments
Open

GHC panic when compiling examples #19

torgeirsh opened this issue Oct 28, 2017 · 9 comments

Comments

@torgeirsh
Copy link

I ran "stack build :misc-examples" and got:
Preprocessing test suite 'misc-examples' for concat-examples-0.3.0.0...
[1 of 1] Compiling Main ( test\Examples.hs, .stack-work\dist\ca59d0ab\build\misc-examples\misc-examples-tmp\Main.o )
ghc.EXE: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-mingw32):
Simplifier ticks exhausted
When trying RuleFired cat equal
To increase the limit, use -fsimpl-tick-factor=N (default 100)
If you need to do this, let GHC HQ know, and what factor you needed
To see detailed counts use -ddump-simpl-stats
Total ticks: 51001

Not sure if it's an actual GHC bug, or something to do with the plugin?

@conal
Copy link
Collaborator

conal commented Oct 28, 2017

Oops! I've been experimenting with some new rewrite rules. I see that even the most basic examples are failing before the CCC plugin even gets started. Investigating. Thanks for the report.

@conal
Copy link
Collaborator

conal commented Oct 28, 2017

I had a few changes not yet pushed. Seems to be working again. Try again?

@torgeirsh
Copy link
Author

Thanks for looking into it! It's still not quite working for me, I get a different error:
Preprocessing library concat-inline-0.1.0.0...
[3 of 3] Compiling ConCat.Inline.SampleMethods ( src\ConCat\Inline\SampleMethods.hs, .stack-work\dist\ca59d0ab\build\ConCat\Inline\SampleMethods.o )
ghc.EXE: panic! (the 'impossible' happened)
(GHC version 8.0.2 for x86_64-unknown-mingw32):
Static flags have not been initialised!
Please call GHC.parseStaticFlags early enough.

To make sure everything is rebuilt, I deleted the .stack-work directory and the global snapshots directory. Let me know if there's anything else that could be left behind.

@conal
Copy link
Collaborator

conal commented Oct 29, 2017

Wow. I've never seen anything like that error. Have you? I don't know whether anyone else has tried using concat on Windows.

@torgeirsh
Copy link
Author

I've never seen anything like it, but I also have never used a compiler plugin before. Maybe it's an issue with the Windows version of GHC.

@conal
Copy link
Collaborator

conal commented Oct 30, 2017

There seem to be other reports of this issue, e.g., here.

@torgeirsh
Copy link
Author

Since they also use GHC 8.0, I tried to change the stackage resolver to nightly-2017-10-31 and see if it works better with GHC 8.2, but BuildDictionary.hs doesn't compile. I guess it's too early to update the code as there's no stackage LTS with GHC 8.2 yet.

@torgeirsh
Copy link
Author

Now that stackage lts-10.0 is out with GHC 8.2, I updated the resolver and tried to build again. This time I get a different panic:

    [3 of 4] Compiling ConCat.Category  ( src\ConCat\Category.hs, .stack-work\dist\5c8418a7\build\ConCat\Category.o )
    ghc.EXE: panic! (the 'impossible' happened)
      (GHC version 8.2.2 for x86_64-unknown-mingw32):
        inlineClassOp failed
      ($dPointed_apHR
       `cast` (N:Pointed[0] <h_apHQ>_N
               :: (Pointed h_apHQ :: Constraint)
                  ~R#
                  ((forall a. a -> h_apHQ a) :: *)))
        @ a_apI3
      Call stack:
          CallStack (from HasCallStack):
            prettyCurrentCallStack, called at compiler\utils\Outputable.hs:1133:58 in ghc:Outputable
            callStackDoc, called at compiler\utils\Outputable.hs:1137:37 in ghc:Outputable
            pprPanic, called at src\ConCat\Inline\Plugin.hs:66:19 in concat-inline-0.1.0.0-DgOLZX7x9V0EDG7Ujj5GxP:ConCat.Inline.Plugin

@conal
Copy link
Collaborator

conal commented Dec 23, 2017

Thanks. I'm seeing the same error with lts-10.0. The issue seems to be a small change in GHC's treatment of single-method classes (Pointed here). I can accommodate this change easily enough, but then I run into more errors due to GHC API changes, which is often the case with new GHC releases.

It will take some time to sort through these changes, and I've been meaning to overhaul this part of the plugin anyway.

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

2 participants