
#16076: Internal compiler error when instance uses FFI function and defining other instance of the same class through Template Haskell -------------------------------------+------------------------------------- Reporter: | Owner: (none) radekchannable | Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.4.4 Keywords: | Operating System: Linux Architecture: | Type of failure: Compile-time Unknown/Multiple | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- When one module defines an FFI function and uses it in an instance, and a Template Haskell function to derive an instance of the same class, using the function in another module causes GHC to crash, complaining it cannot find the FFI function. See the attached modules for an example. Use the following command to trigger the bug (ensure template-haskell is available): {{{ $ ghc Bar.hs [1 of 2] Compiling Foo ( Foo.hs, Foo.o ) [2 of 2] Compiling Bar ( Bar.hs, Bar.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.4.4 for x86_64-unknown-linux): Loading temp shared object failed: /tmp/ghc13955_0/libghc_6.so: undefined symbol: showFoo Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16076 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler