Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,265
    • Issues 5,265
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 569
    • Merge requests 569
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #20277
Closed
Open
Issue created Aug 24, 2021 by sheaf@sheafMaintainer

Representation-polymorphic unboxed sum causes a panic

The existing representation-polymorphism checks allow some unboxed sums to slip through the cracks:

{-# LANGUAGE MagicHash #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE UnboxedTuples #-}

module RepPolySum where

import GHC.Exts

baz :: forall (rep :: RuntimeRep) (a :: TYPE rep). () -> (# Int# | a #)
baz _ = (# 17# | #)
ghc: panic! (the 'impossible' happened)
  (GHC version 9.0.1:
        runtimeRepPrimRep
  typePrimRep (a_aCt :: TYPE rep_aCs)
  rep_aCs
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler\GHC\Utils\Outputable.hs:1230:37 in ghc:GHC.Utils.Outputable
        pprPanic, called at compiler\\GHC\\Types\\RepType.hs:527:5 in ghc:GHC.Types.RepType

(That's with GHC 9.0; the same error exists on HEAD.)

It wouldn't be hard to fix with the existing mechanisms (in the desugarer), but I'm currently fixing it in the typechecker as part of !6164 (closed).

Edited Aug 24, 2021 by sheaf
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking