Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,323
    • Issues 4,323
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 385
    • Merge Requests 385
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #10602

Closed
Open
Opened Jul 04, 2015 by pacak@trac-pacak

ghc panic: Template variable unbound in rewrite rule when compiling with -O2

I've seen a few related tickets, but they are market as closed.

% ghc -O2 binlist.hs


[1 of 1] Compiling Main             ( binlist.hs, binlist.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 7.10.1.20150630 for x86_64-unknown-linux):
        Template variable unbound in rewrite rule
  sg_s5zh
  [sc_s5zf, sc_s5zg, sg_s5zh, sg_s5zi]
  [sc_s5zf, sc_s5zg, sg_s5zh, sg_s5zi]
  [: @ a_a3fo sc_s5zf sc_s5zg]
  [: @ a_a3fo sc_s5zb sc_s5zc]

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

% cat binlist.hs

import Control.Monad
import Data.Binary
import Data.List


newtype A a = A [a]


instance Binary a => Binary (A a) where
    put (A xs) = case splitAt 254 xs of
        (_, []) -> mapM_ put xs
        (a, b)  -> put (A b)
 
    get = do xs <- replicateM 254 get
             A ys <- get
             return $ A $ xs ++ ys

main :: IO ()
main = undefined
Edited Mar 10, 2019 by Richard Eisenberg
Assignee
Assign to
7.10.2
Milestone
7.10.2 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#10602