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,311
    • Issues 4,311
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 382
    • Merge Requests 382
  • 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
  • #14680

Closed
Open
Opened Jan 17, 2018 by Ryan Scott@RyanGlScottMaintainer

GHC 8.4.1-alpha panics when optimizing function using getTag and tagToEnum#

I originally observed this panic in this Travis build. The panic can be reduced to this file:

{-# LANGUAGE MagicHash #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where

import GHC.Base (getTag)
import GHC.Exts (Int(..), tagToEnum#)

data family TyFamilyEnum
data instance TyFamilyEnum = TyFamilyEnum1 | TyFamilyEnum2 | TyFamilyEnum3

suc :: TyFamilyEnum -> TyFamilyEnum
suc a_aaf8
        = case getTag a_aaf8 of
             a_aaf9
               -> if 2 ==  I# a_aaf9
                  then error "succ{TyFamilyEnum}: tried to take `succ' of last tag in enumeration"
                  else case I# a_aaf9 + 1 of
                         I# i_aafa -> tagToEnum# i_aafa :: TyFamilyEnum

In GHC 8.2.2, compiling this with optimization works fine. But in GHC 8.4.1-alpha, it panics:

$ /opt/ghc/8.4.1/bin/ghc -fforce-recomp -O1 Bug.hs
[1 of 1] Compiling Bug              ( Bug.hs, Bug.o )
ghc: panic! (the 'impossible' happened)
  (GHC version 8.4.0.20171222 for x86_64-unknown-linux):
        Prelude.!!: index too large
Trac metadata
Trac field Value
Version 8.4.1-alpha1
Type Bug
TypeOfFailure OtherFailure
Priority highest
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
Assignee
Assign to
8.4.1
Milestone
8.4.1 (Past due)
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#14680