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,410
    • Issues 5,410
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 604
    • Merge requests 604
  • 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
  • #22725
Closed
Open
Issue created Jan 08, 2023 by Krzysztof Gogolewski@monoidalDeveloper

Panic with -O and representation polymorphism

The following file, found during investigation of #22715 (closed), causes a panic in master with -O

module M where

import GHC.Exts (TYPE)

f :: forall r (a :: TYPE r). () -> a
f x = f x
[g@g-work:~/haskell/ghc/_build]$ ./stage1/bin/ghc -O M
[1 of 1] Compiling M                ( M.hs, M.o ) [Source file changed]

<no location info>: error:
    panic! (the 'impossible' happened)
  GHC version 9.7.20230103:
	typeKind
  forall {r :: RuntimeRep} {a :: TYPE r}. a
  [r_sH5, a_sH6]
  a_sH6 :: TYPE r_sH5
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/GHC/Utils/Panic.hs:189:37 in ghc:GHC.Utils.Panic
        pprPanic, called at compiler/GHC/Core/Type.hs:2575:18 in ghc:GHC.Core.Type
        typeKind, called at compiler/GHC/Core/Type.hs:2623:48 in ghc:GHC.Core.Type
        typeTypeOrConstraint, called at compiler/GHC/Core/Type.hs:1363:48 in ghc:GHC.Core.Type
        chooseFunTyFlag, called at compiler/GHC/Core/Type.hs:1348:10 in ghc:GHC.Core.Type
  CallStack (from HasCallStack):
    panic, called at compiler/GHC/Utils/Error.hs:454:29 in ghc:GHC.Utils.Error

GHC 9.4 fails Lint

*** Core Lint errors : in result of Worker Wrapper binds ***
M.hs:6:1: warning:
    Variable escape in forall:
      tyvar: r_sEE
      type: forall {a :: TYPE r_sEE}. a
      kind: TYPE r_sEE
    In the type of a binder: $wf_sEI
    In the type ‘(# #) -> forall {r :: RuntimeRep} {a :: TYPE r}. a’
Edited Jan 08, 2023 by Krzysztof Gogolewski
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking