[GHC] #12060: GHC panic depending on what a Haskell module is named

GHC ghc-devs at haskell.org
Sat May 14 13:31:11 UTC 2016


#12060: GHC panic depending on what a Haskell module is named
----------------------------------+--------------------------------------
        Reporter:  Darwin226      |                Owner:
            Type:  bug            |               Status:  new
        Priority:  normal         |            Milestone:
       Component:  GHCi           |              Version:  7.10.3
      Resolution:                 |             Keywords:
Operating System:  Windows        |         Architecture:  x86_64 (amd64)
 Type of failure:  Runtime crash  |            Test Case:
      Blocked By:                 |             Blocking:
 Related Tickets:                 |  Differential Rev(s):
       Wiki Page:                 |
----------------------------------+--------------------------------------
Description changed by Darwin226:

@@ -34,1 +34,1 @@
- run the repl it doesn't recompile the project but it launches the repl
+ run the repl it fails to recompile the project but it launches the repl

New description:

 I'm trying to make bindings for the imgui C++ library and have encountered
 an apparent bug. I'm unable to produce a minimal example so I've packed up
 the whole project in a zip file. It only works on Windows for now but I
 assume this problem is platform dependant anyways.

 There's a module `UI.Imgui` that imports two things. A `FunPtr` wrapping
 function and an actual function defined in a .cpp file. Another module
 Main imports this module.

 If the project is run in a repl (in my case I'm doing `stack repl`) and
 then the `test` function is evaluated it results in a GHC panic

 {{{#!hs
 ghc.exe: panic! (the 'impossible' happened)
   (GHC version 7.10.3 for x86_64-unknown-mingw32):
         loadObj
 "C:\\Users\\Luka\\AppData\\Local\\Temp\\ghc5900_0\\ghc_5.o": failed

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
 }}}

 Now here's the fun part. If you rename the module, file and it's import to
 something like Imgui2 it works. If you rename it to UI2.Imgui (with
 appropriate folder renaming) it also works!

 I'm sure a huge portion of the code is irrelevant. I couldn't reproduce
 this with simple .cpp files.

 Here's a link to the file (3MB)
 https://dl.dropboxusercontent.com/u/35032740/ShareX/2016/05/imgui.zip

 Update: Ok so it seems that the "reason" why renaming the file works is
 because I forgot to change the entry in the cabal file so the next time I
 run the repl it fails to recompile the project but it launches the repl
 using the previous build. Why it doesn't panic in that case I have no
 idea.

 Also, here's another thing that fixes is:
 Run the repl -> try test -> GHC panic -> save the Imgui file (without
 changing anything, just so you can :r it) -> do :r in GHCi -> try test ->
 works

--

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


More information about the ghc-tickets mailing list