
#8892: Ghc panics (variable not found) ---------------------------------------+----------------------------------- Reporter: jwlato | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time crash | Unknown/Multiple Test Case: | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Comment (by jwlato): I've made a test case that I hope is small enough you can work with. This has dependencies on the `vector` and `vector-space` packages. There are two files, `Piecewise.hs` and `Broken.hs`. To trigger the bug, you need to first compile `Piecewise.hs` and install it to ghc's package database, then attempt to compile `Broken.hs` via `ghc -O Broken.hs`. Trying to compile `Broken.hs` when ghc can find `Piecewise.hs` works properly for me. I've put a repo on github with a minimal cabal file also, https://github.com/JohnLato/ghc-8892 I can trigger the bug with any optimization level except `-O0`. `Piecewise.hs` defines `instance (AdditiveGroup (poly a), Ord a) => AdditiveGroup (Piecewise poly a)`, with `{-# SPECIALISE instance AdditiveGroup (Piecewise Scale Double) #-}`. That SPECIALIZE instance pragma, and the `INLINE negateV` pragma, both seem required to trigger this. I haven't attempted to simplify the definition of `^+^` at all, I'll continue with that tomorrow. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8892#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler