Admin message

Due to a large amount of spam we do not allow new users to create repositories, they are "external" users. If you are a new user and want to create a repository, for example for forking GHC, open a new issue on ghc/ghc using the "get-verified" issue template

Program crashes with "Entered absent arg" error for "inferred instance?"
## Summary I have isolated the part and reproducible steps that cause program to crash with "Entered absent arg" message. However, I failed to further simplify it to a minor example independent of my project. I hope this bug report still contains enough information for some of you to tell what could have gone wrong. See also * #26416 * A similar-looking bug: #24934 ## Steps to reproduce GHC 9.10+ required. ``` $ git clone https://github.com/yolc-dev/yul-dsl-monorepo.git $ git checkout ghc-issue-25924 $ make build-all $ export PATH=$PWD/hs-pkgs/yol-suite/bin/:$PATH $ yolc -vfm yul "examples/demo" runyol: internal error: Oops! Entered absent arg Arg: $dYulCatObj Type: YulO1 b In module `YulDSL.Haskell.Data.SHMap' Stack trace: runyol: Failed to get stack frames of current process: No DWARF information found: Success ... ``` ### Notes on Relevant Code One important hint is that the bug is not reproducible when using "-O0," which could mean it is an error related to the optimizer. The function signature that made a difference is the following: ```haskell -- | Get a storage reference from the storage hash-map. shmapRef :: forall a b ie r v. ( KnownNat v, YulO3 r a b ) => SHMap a b -> P'x ie r a ⊸ YulMonad v v r (P'x ie r (REF b)) -- Relevant definitions: type YulO1 a = YulCatObj a type YulO2 a b = (YulCatObj a, YulO1 b) type YulO3 a b c = (YulCatObj a, YulO2 b c) type YulO4 a b c d = (YulCatObj a, YulO3 b c d) instance YulCatObj a => YulCatObj (REF a) newtype REF a = REF Integer deriving (Ord, Eq) ``` The program crashes at some point with the following error message: ``` runyol: internal error: Oops! Entered absent arg Arg: $dYulCatObj Type: YulO1 b In module `YulDSL.Haskell.Data.SHMap' Stack trace: runyol: Failed to get stack frames of current process: No DWARF information found: Success ``` By adding `YulCatObj (REF b)` to the function signature: ``` shmapRef :: forall a b ie r v. ( KnownNat v, YulO4 r a b (REF b) ) => SHMap a b -> P'x ie r a ⊸ YulMonad v v r (P'x ie r (REF b)) ``` The error goes away. Few observations: 1) As it was mentioned above, it is worth noting that "instance YulCatObj a => YulCatObj (REF a)" should make that fix unnecessary. 2) In the definition of "REF a", a is a phantom type variable. ## Expected behavior GHC should either throw a type error (if any) or not crash. ## Environment * GHC version used: GHC 9.10.1 & 9.12.1
issue