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

exprIsLambda_maybe: Unexpected lambda in case
## Summary When compiling certain files, GHC emits a "exprIsLambda_maybe: Unexpected lambda in case" message on stdout. This is not a error or warning, but (presumably) a pprTrace from https://gitlab.haskell.org/ghc/ghc/-/blob/master/compiler/GHC/Core/Opt/Arity.hs#L1797. It is unclear to me whether this is a benign message or represents an actual problem. ## Steps to reproduce Bug.hs (depends on optics-core=0.4. See below for a self-contained reproducer) ``` {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedLabels #-} {-# OPTIONS_GHC -Wall -dcore-lint #-} module Bug (bar) where import GHC.Generics (Generic) import Optics.Setter import Optics.Optic import Optics.Label () data A = MkA () deriving Generic data B = B {getB :: A} deriving Generic ba :: Setter' B A ba = castOptic #getB aunit :: Setter' A () aunit = castOptic #_MkA bar :: Monad m => m [B] bar = do _ <- pure [] pure $ over (mapped %% ba) updateDefs [] where updateDefs = over aunit id ``` Compile the above file with `-O` and ghc 9.2.2: ``` $ ghc -O -fforce-recomp Bug.hs [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) exprIsLambda_maybe: Unexpected lambda in case \ (eta_B0 :: B) -> $cto_a2rq @Any (((updateDefs_s3gG `cast` ((N:FunArrow[0] <Curry NoIx Any>_P ; Sym (N:FunArrow[0] <Any>_P)) <A>_N <A>_N ; N:FunArrow[0] <Any>_P <A>_N <A>_N :: FunArrow (Curry NoIx Any) A A ~R# (A -> A))) (case eta_B0 of { B ds_d32G -> ds_d32G })) `cast` (Sym (N:K1[0] <Type>_N <R>_P <A>_R <Any>_P) ; (Sym (N:M1[0] <Type>_N <S>_P <'MetaSel ('Just "getB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy>_P <Rec0 A>_R) ; Sym (N:M1[0] <Type>_N <C>_P <'MetaCons "B" 'PrefixI 'True>_P <M1 S ('MetaSel ('Just "getB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 A)>_R) ; Sym (N:M1[0] <Type>_N <D>_P <'MetaData "B" "Bug" "main" 'False>_P <M1 C ('MetaCons "B" 'PrefixI 'True) (S1 ('MetaSel ('Just "getB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 A))>_R) ; Sub (Sym (Rep_B[0]))) <Any>_N :: A ~R# Rep B Any)) ``` <details><summary>`ghc -v` output</summary> ``` $ ghc -v -O Bug.hs -fforce-recomp Glasgow Haskell Compiler, Version 9.2.2, stage 2 booted by GHC version 8.10.7 *** initializing unit database: Using binary package database: /nix/store/065vznbk990dd2qkdd7qyr5wfrvh52p7-ghc-9.2.2-with-packages/lib/ghc-9.2.2/package.conf.d/package.cache package flags [] loading package database /nix/store/065vznbk990dd2qkdd7qyr5wfrvh52p7-ghc-9.2.2-with-packages/lib/ghc-9.2.2/package.conf.d wired-in package ghc-prim mapped to ghc-prim-0.8.0 wired-in package ghc-bignum mapped to ghc-bignum-1.2 wired-in package base mapped to base-4.16.1.0 wired-in package rts mapped to rts wired-in package template-haskell mapped to template-haskell-2.18.0.0 wired-in package ghc mapped to ghc-9.2.2 !!! initializing unit database: finished in 4.97 milliseconds, allocated 6.073 megabytes *** initializing unit database: package flags [] loading package database /nix/store/065vznbk990dd2qkdd7qyr5wfrvh52p7-ghc-9.2.2-with-packages/lib/ghc-9.2.2/package.conf.d wired-in package ghc-prim mapped to ghc-prim-0.8.0 wired-in package ghc-bignum mapped to ghc-bignum-1.2 wired-in package base mapped to base-4.16.1.0 wired-in package rts mapped to rts wired-in package template-haskell mapped to template-haskell-2.18.0.0 wired-in package ghc mapped to ghc-9.2.2 !!! initializing unit database: finished in 13.92 milliseconds, allocated 3.559 megabytes *** Chasing dependencies: Chasing modules from: Bug.hs !!! Chasing dependencies: finished in 0.95 milliseconds, allocated 1.489 megabytes Stable obj: {} Stable BCO: {} Ready for upsweep [NONREC ModSummary { ms_hs_date = 2022-05-11 19:24:15.264209807 UTC ms_mod = Bug, ms_textual_imps = [(Nothing, Prelude), (Nothing, Optics.Label), (Nothing, Optics.Optic), (Nothing, Optics.Setter), (Nothing, GHC.Generics)] ms_srcimps = [] } []] *** Deleting temp files: Deleting: compile: input file Bug.hs *** Checking old interface for Bug (use -ddump-hi-diffs for more details): [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) *** Parser [Bug]: !!! Parser [Bug]: finished in 0.48 milliseconds, allocated 0.821 megabytes *** Renamer/typechecker [Bug]: !!! Renamer/typechecker [Bug]: finished in 124.63 milliseconds, allocated 68.782 megabytes *** Desugar [Bug]: Result size of Desugar (before optimization) = {terms: 422, types: 2,528, coercions: 1,408, joins: 0/25} *** Core Linted result of Desugar (before optimization): Result size of Desugar (after optimization) = {terms: 264, types: 1,677, coercions: 1,487, joins: 0/2} *** Core Linted result of Desugar (after optimization): !!! Desugar [Bug]: finished in 28.23 milliseconds, allocated 33.476 megabytes *** Simplifier [Bug]: Result size of Simplifier iteration=1 = {terms: 424, types: 2,966, coercions: 5,323, joins: 0/27} *** Core Linted result of Simplifier: exprIsLambda_maybe: Unexpected lambda in case \ (eta_B0 :: B) -> $cto_a2rq @Any (((updateDefs_s3gG `cast` ((N:FunArrow[0] <Curry NoIx Any>_P ; Sym (N:FunArrow[0] <Any>_P)) <A>_N <A>_N ; N:FunArrow[0] <Any>_P <A>_N <A>_N :: FunArrow (Curry NoIx Any) A A ~R# (A -> A))) (case eta_B0 of { B ds_d32G -> ds_d32G })) `cast` (Sym (N:K1[0] <Type>_N <R>_P <A>_R <Any>_P) ; (Sym (N:M1[0] <Type>_N <S>_P <'MetaSel ('Just "getB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy>_P <Rec0 A>_R) ; Sym (N:M1[0] <Type>_N <C>_P <'MetaCons "B" 'PrefixI 'True>_P <M1 S ('MetaSel ('Just "getB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 A)>_R) ; Sym (N:M1[0] <Type>_N <D>_P <'MetaData "B" "Bug" "main" 'False>_P <M1 C ('MetaCons "B" 'PrefixI 'True) (S1 ('MetaSel ('Just "getB") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 A))>_R) ; Sub (Sym (Rep_B[0]))) <Any>_N :: A ~R# Rep B Any)) Result size of Simplifier iteration=2 = {terms: 194, types: 246, coercions: 1,958, joins: 0/7} *** Core Linted result of Simplifier: Result size of Simplifier = {terms: 143, types: 110, coercions: 318, joins: 0/1} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 41.63 milliseconds, allocated 61.074 megabytes *** Specialise [Bug]: Result size of Specialise = {terms: 143, types: 110, coercions: 318, joins: 0/1} *** Core Linted result of Specialise: !!! Specialise [Bug]: finished in 0.83 milliseconds, allocated 1.323 megabytes *** Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False}) [Bug]: Result size of Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False}) = {terms: 149, types: 121, coercions: 318, joins: 0/2} *** Core Linted result of Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False}): !!! Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False}) [Bug]: finished in 1.57 milliseconds, allocated 1.597 megabytes *** Simplifier [Bug]: Result size of Simplifier iteration=1 = {terms: 147, types: 115, coercions: 318, joins: 0/2} *** Core Linted result of Simplifier: Result size of Simplifier = {terms: 147, types: 115, coercions: 318, joins: 0/2} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 3.04 milliseconds, allocated 4.197 megabytes *** Simplifier [Bug]: Result size of Simplifier iteration=1 = {terms: 143, types: 111, coercions: 318, joins: 0/2} *** Core Linted result of Simplifier: Result size of Simplifier = {terms: 141, types: 108, coercions: 318, joins: 0/2} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 2.86 milliseconds, allocated 4.160 megabytes *** Simplifier [Bug]: Result size of Simplifier = {terms: 141, types: 108, coercions: 318, joins: 0/2} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 1.42 milliseconds, allocated 2.075 megabytes *** Float inwards [Bug]: Result size of Float inwards = {terms: 141, types: 108, coercions: 318, joins: 0/2} *** Core Linted result of Float inwards: !!! Float inwards [Bug]: finished in 0.79 milliseconds, allocated 1.285 megabytes *** Called arity analysis [Bug]: Result size of Called arity analysis = {terms: 141, types: 108, coercions: 318, joins: 0/2} *** Core Linted result of Called arity analysis: !!! Called arity analysis [Bug]: finished in 0.79 milliseconds, allocated 1.316 megabytes *** Simplifier [Bug]: Result size of Simplifier = {terms: 141, types: 108, coercions: 318, joins: 0/2} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 1.71 milliseconds, allocated 2.075 megabytes *** Demand analysis [Bug]: Result size of Demand analysis = {terms: 141, types: 108, coercions: 318, joins: 0/2} *** Core Linted result of Demand analysis: !!! Demand analysis [Bug]: finished in 0.84 milliseconds, allocated 1.341 megabytes *** Constructed Product Result analysis [Bug]: Result size of Constructed Product Result analysis = {terms: 141, types: 108, coercions: 318, joins: 0/2} *** Core Linted result of Constructed Product Result analysis: !!! Constructed Product Result analysis [Bug]: finished in 0.85 milliseconds, allocated 1.350 megabytes *** Worker Wrapper binds [Bug]: Result size of Worker Wrapper binds = {terms: 166, types: 198, coercions: 318, joins: 0/6} *** Core Linted result of Worker Wrapper binds: !!! Worker Wrapper binds [Bug]: finished in 1.10 milliseconds, allocated 1.596 megabytes *** Simplifier [Bug]: Result size of Simplifier iteration=1 = {terms: 159, types: 189, coercions: 318, joins: 0/4} *** Core Linted result of Simplifier: Result size of Simplifier = {terms: 147, types: 160, coercions: 318, joins: 0/1} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 3.56 milliseconds, allocated 4.717 megabytes *** Exitification transformation [Bug]: Result size of Exitification transformation = {terms: 147, types: 160, coercions: 318, joins: 0/1} *** Core Linted result of Exitification transformation: !!! Exitification transformation [Bug]: finished in 0.93 milliseconds, allocated 1.384 megabytes *** Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = True}) [Bug]: Result size of Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = True}) = {terms: 147, types: 160, coercions: 318, joins: 0/1} *** Core Linted result of Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = True}): !!! Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = True}) [Bug]: finished in 1.18 milliseconds, allocated 1.743 megabytes *** Common sub-expression [Bug]: Result size of Common sub-expression = {terms: 147, types: 160, coercions: 318, joins: 0/1} *** Core Linted result of Common sub-expression: !!! Common sub-expression [Bug]: finished in 1.31 milliseconds, allocated 1.520 megabytes *** Float inwards [Bug]: Result size of Float inwards = {terms: 147, types: 160, coercions: 318, joins: 0/1} *** Core Linted result of Float inwards: !!! Float inwards [Bug]: finished in 0.87 milliseconds, allocated 1.440 megabytes *** Simplifier [Bug]: Result size of Simplifier = {terms: 147, types: 160, coercions: 318, joins: 0/1} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 1.62 milliseconds, allocated 2.308 megabytes *** Demand analysis [Bug]: Result size of Demand analysis = {terms: 147, types: 160, coercions: 318, joins: 0/1} *** Core Linted result of Demand analysis: !!! Demand analysis [Bug]: finished in 0.97 milliseconds, allocated 1.506 megabytes *** CoreTidy [Bug]: Result size of Tidy Core = {terms: 147, types: 160, coercions: 318, joins: 0/1} *** Core Linted result of Tidy Core: !!! CoreTidy [Bug]: finished in 1.24 milliseconds, allocated 1.757 megabytes Created temporary directory: /tmp/nix-shell.l4CKl0/ghc3061224_0 *** CorePrep [Bug]: Result size of CorePrep = {terms: 159, types: 176, coercions: 318, joins: 0/3} *** Core Linted result of CorePrep: !!! CorePrep [Bug]: finished in 1.27 milliseconds, allocated 1.831 megabytes *** CoreToStg [Bug]: *** Stg2Stg: !!! CoreToStg [Bug]: finished in 0.17 milliseconds, allocated 0.240 megabytes *** CodeGen [Bug]: !!! CodeGen [Bug]: finished in 6.67 milliseconds, allocated 7.047 megabytes *** systool:as: *** Assembler: /nix/store/bg35nfwn6zd616facdywiysgpprfvsji-gcc-wrapper-11.3.0/bin/cc -iquote. -no-pie -fno-PIC -x assembler -c /tmp/nix-shell.l4CKl0/ghc3061224_0/ghc_2.s -o Bug.o.tmp !!! systool:as: finished in 0.34 milliseconds, allocated 0.122 megabytes Upsweep completely successful. *** Deleting temp files: Deleting: /tmp/nix-shell.l4CKl0/ghc3061224_0/ghc_1.s /tmp/nix-shell.l4CKl0/ghc3061224_0/ghc_2.s /tmp/nix-shell.l4CKl0/ghc3061224_0/ghc_3.c Warning: deleting non-existent /tmp/nix-shell.l4CKl0/ghc3061224_0/ghc_1.s Warning: deleting non-existent /tmp/nix-shell.l4CKl0/ghc3061224_0/ghc_3.c link(batch): upsweep (partially) failed OR Main.main not exported; not linking. *** Deleting temp files: Deleting: *** Deleting temp dirs: Deleting: /tmp/nix-shell.l4CKl0/ghc3061224_0 ``` </details> Note that getting ghc to output such a message seems rather sensitive to small changes in the code, and to changing versions of ghc. The above gives such output for ghc 9.2.2, 9.0.2, 8.10.7 (9.2.1 and 9.0.1 untested). To get a standalone example, I have inlined code from optics and attempted to minimise, resulting in ``` {-# LANGUAGE AllowAmbiguousTypes #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeInType #-} {-# OPTIONS_GHC -Wall -dcore-lint #-} module Bug (bar) where import GHC.Generics import GHC.Exts (Constraint) import Data.Coerce (coerce) import Data.Kind (Type) data A = MkA () deriving Generic data B = B A ba :: Optic A_Setter B B A A ba = Optic $ dimap (\(B e) -> (e, B e)) (B . fst) . first' -- NB: removing fst and first' hides the message -- NB: aunit = undefined shows error in 8.10.7 and 9.0.1 but not 9.2.1 aunit :: Optic A_Setter A A () () aunit = case foo (Market id Right) of Market construct match -> Optic $ dimap match (either id construct) . undefined where foo :: Profunctor p => p NoIx () () -> p NoIx A A foo = dimap from to . dimap coerce coerce bar :: Monad m => m [B] bar = do _ <- pure [] pure $ over (mapped %% ba) inner [] where -- NB: inlining inner hides the bug inner = over aunit id ----- -- Some minimised code originating from optics-core follows over :: forall k s t a b. Is k A_Setter -- NB: setting k ~ A_Setter avoids the message => Optic k s t a b -> (a -> b) -> s -> t over o f = runFunArrow $ getOptic (castOptic' o) (FunArrow f) where castOptic' :: Optic k s t a b -> Optic A_Setter s t a b castOptic' = castOptic @A_Setter mapped :: Functor f => Optic A_Setter (f a) (f b) a b mapped = Optic (roam fmap) newtype Optic (k :: OpticKind) s t a b = Optic (forall p i. Profunctor p => Optic_ k p i (Curry i) s t a b) getOptic :: Profunctor p => Optic k s t a b -> Optic_ k p i i s t a b getOptic (Optic o) = o type Optic_ k p i j s t a b = Constraints k p => Optic__ p i j s t a b type Optic__ p i j s t a b = p i a b -> p j s t castOptic :: forall destKind srcKind s t a b . Is srcKind destKind => Optic srcKind s t a b -> Optic destKind s t a b castOptic (Optic o) = Optic (cast o) where cast :: forall p i . Optic_ srcKind p i i s t a b -> Optic_ destKind p i i s t a b cast x = implies @srcKind @destKind @p x infixl 9 %% (%%) :: forall s t u v a b. Optic A_Setter s t u v -> Optic A_Setter u v a b -> Optic A_Setter s t a b Optic o %% Optic o' = Optic (o . o') class Is k l where implies :: (Constraints k p => r) -> (Constraints l p => r) instance Is k k where implies r = r type OpticKind = Type data A_Setter :: OpticKind -- Changing this into a synonym hides the bug type family Constraints (k :: OpticKind) (p :: Type -> Type -> Type -> Type) :: Constraint where Constraints A_Setter p = Mapping p -- Changing this into a synonym hides the bug type family Curry (y :: Type) :: Type where Curry y = y type IxList = [Type] type NoIx = ('[] :: IxList) class Profunctor p where dimap :: (a -> b) -> (c -> d) -> p i b c -> p i a d class Profunctor p => Strong p where first' :: p i a b -> p i (a, c) (b, c) class Strong p => Mapping p where roam :: ((a -> b) -> s -> t) -> p i a b -> p i s t data Market a b i s t = Market (b -> t) (s -> Either t a) instance Profunctor (Market a b) where dimap f g (Market bt seta) = Market (g . bt) (either (Left . g) Right . seta . f) -- NB: changing this to data hides the bug newtype FunArrow i a b = FunArrow { runFunArrow :: a -> b } instance Profunctor FunArrow where dimap f g (FunArrow k) = FunArrow (g . k . f) instance Strong FunArrow where first' (FunArrow k) = FunArrow $ \ ~(a, b) -> (k a, b) instance Mapping FunArrow where roam f (FunArrow k) = FunArrow $ f k ``` This gives similar messages for ghc 9.2.2, 9.2.1, 9.0.2, 9.0.1, 8.10.7, 8.8.4 <details><summary>For ghc 9.2.2 with `-v`, this gives</summary> ``` $ ghc -v -O Bug.hs -fforce-recomp Glasgow Haskell Compiler, Version 9.2.2, stage 2 booted by GHC version 8.10.7 *** initializing unit database: Using binary package database: /nix/store/kmlcs0v3z7hffnkjd51ipfsl6n7x67al-ghc-9.2.2/lib/ghc-9.2.2/package.conf.d/package.cache package flags [] loading package database /nix/store/kmlcs0v3z7hffnkjd51ipfsl6n7x67al-ghc-9.2.2/lib/ghc-9.2.2/package.conf.d wired-in package ghc-prim mapped to ghc-prim-0.8.0 wired-in package ghc-bignum mapped to ghc-bignum-1.2 wired-in package base mapped to base-4.16.1.0 wired-in package rts mapped to rts wired-in package template-haskell mapped to template-haskell-2.18.0.0 wired-in package ghc mapped to ghc-9.2.2 !!! initializing unit database: finished in 5.48 milliseconds, allocated 5.776 megabytes *** initializing unit database: package flags [] loading package database /nix/store/kmlcs0v3z7hffnkjd51ipfsl6n7x67al-ghc-9.2.2/lib/ghc-9.2.2/package.conf.d wired-in package ghc-prim mapped to ghc-prim-0.8.0 wired-in package ghc-bignum mapped to ghc-bignum-1.2 wired-in package base mapped to base-4.16.1.0 wired-in package rts mapped to rts wired-in package template-haskell mapped to template-haskell-2.18.0.0 wired-in package ghc mapped to ghc-9.2.2 !!! initializing unit database: finished in 14.45 milliseconds, allocated 3.381 megabytes *** Chasing dependencies: Chasing modules from: Bug.hs !!! Chasing dependencies: finished in 2.93 milliseconds, allocated 2.896 megabytes Stable obj: {} Stable BCO: {} Ready for upsweep [NONREC ModSummary { ms_hs_date = 2022-05-11 19:21:07.193278949 UTC ms_mod = Bug, ms_textual_imps = [(Nothing, Prelude), (Nothing, Data.Kind), (Nothing, Data.Coerce), (Nothing, GHC.Exts), (Nothing, GHC.Generics)] ms_srcimps = [] } []] *** Deleting temp files: Deleting: compile: input file Bug.hs *** Checking old interface for Bug (use -ddump-hi-diffs for more details): [1 of 1] Compiling Bug ( Bug.hs, Bug.o ) *** Parser [Bug]: !!! Parser [Bug]: finished in 13.91 milliseconds, allocated 4.816 megabytes *** Renamer/typechecker [Bug]: !!! Renamer/typechecker [Bug]: finished in 131.17 milliseconds, allocated 96.275 megabytes *** Desugar [Bug]: Result size of Desugar (before optimization) = {terms: 918, types: 2,252, coercions: 434, joins: 0/76} *** Core Linted result of Desugar (before optimization): Result size of Desugar (after optimization) = {terms: 633, types: 1,357, coercions: 559, joins: 0/6} *** Core Linted result of Desugar (after optimization): !!! Desugar [Bug]: finished in 13.59 milliseconds, allocated 15.928 megabytes *** Simplifier [Bug]: Result size of Simplifier iteration=1 = {terms: 710, types: 1,204, coercions: 996, joins: 0/23} *** Core Linted result of Simplifier: exprIsLambda_maybe: Unexpected lambda in case \ (eta_B0 :: B) -> B ((inner_s2Sp `cast` ((N:FunArrow[0] <Type>_N Univ(phantom phantom <Type>_N :: Curry Any, Any) ; Sym (N:FunArrow[0] <Type>_N <Any>_P)) <A>_N <A>_N ; N:FunArrow[0] <Type>_N <Any>_P <A>_N <A>_N :: FunArrow (Curry Any) A A ~R# (A -> A))) (case case eta_B0 of { B e_a14H -> (e_a14H, B e_a14H) } of { (a_a142, _ [Occ=Dead]) -> a_a142 })) Result size of Simplifier iteration=2 = {terms: 649, types: 858, coercions: 705, joins: 0/11} *** Core Linted result of Simplifier: Result size of Simplifier = {terms: 531, types: 497, coercions: 352, joins: 0/1} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 25.10 milliseconds, allocated 34.110 megabytes *** Specialise [Bug]: Result size of Specialise = {terms: 531, types: 497, coercions: 352, joins: 0/1} *** Core Linted result of Specialise: !!! Specialise [Bug]: finished in 1.88 milliseconds, allocated 3.084 megabytes *** Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False}) [Bug]: Result size of Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False}) = {terms: 537, types: 508, coercions: 352, joins: 0/2} *** Core Linted result of Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False}): !!! Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = False}) [Bug]: finished in 2.57 milliseconds, allocated 3.978 megabytes *** Simplifier [Bug]: Result size of Simplifier iteration=1 = {terms: 535, types: 502, coercions: 352, joins: 0/2} *** Core Linted result of Simplifier: Result size of Simplifier = {terms: 535, types: 502, coercions: 352, joins: 0/2} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 6.53 milliseconds, allocated 9.401 megabytes *** Simplifier [Bug]: Result size of Simplifier iteration=1 = {terms: 531, types: 498, coercions: 352, joins: 0/2} *** Core Linted result of Simplifier: Result size of Simplifier = {terms: 529, types: 495, coercions: 352, joins: 0/2} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 6.38 milliseconds, allocated 9.361 megabytes *** Simplifier [Bug]: Result size of Simplifier = {terms: 529, types: 495, coercions: 352, joins: 0/2} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 2.91 milliseconds, allocated 4.675 megabytes *** Float inwards [Bug]: Result size of Float inwards = {terms: 529, types: 495, coercions: 352, joins: 0/2} *** Core Linted result of Float inwards: !!! Float inwards [Bug]: finished in 1.71 milliseconds, allocated 2.924 megabytes *** Called arity analysis [Bug]: Result size of Called arity analysis = {terms: 529, types: 495, coercions: 352, joins: 0/2} *** Core Linted result of Called arity analysis: !!! Called arity analysis [Bug]: finished in 1.89 milliseconds, allocated 3.126 megabytes *** Simplifier [Bug]: Result size of Simplifier iteration=1 = {terms: 529, types: 495, coercions: 352, joins: 0/2} *** Core Linted result of Simplifier: Result size of Simplifier = {terms: 505, types: 487, coercions: 352, joins: 0/2} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 6.56 milliseconds, allocated 9.260 megabytes *** Demand analysis [Bug]: Result size of Demand analysis = {terms: 505, types: 487, coercions: 352, joins: 0/2} *** Core Linted result of Demand analysis: !!! Demand analysis [Bug]: finished in 1.86 milliseconds, allocated 3.053 megabytes *** Constructed Product Result analysis [Bug]: Result size of Constructed Product Result analysis = {terms: 505, types: 487, coercions: 352, joins: 0/2} *** Core Linted result of Constructed Product Result analysis: !!! Constructed Product Result analysis [Bug]: finished in 1.79 milliseconds, allocated 2.812 megabytes *** Worker Wrapper binds [Bug]: Result size of Worker Wrapper binds = {terms: 579, types: 737, coercions: 352, joins: 0/10} *** Core Linted result of Worker Wrapper binds: !!! Worker Wrapper binds [Bug]: finished in 2.68 milliseconds, allocated 3.937 megabytes *** Simplifier [Bug]: Result size of Simplifier iteration=1 = {terms: 556, types: 650, coercions: 352, joins: 0/6} *** Core Linted result of Simplifier: Result size of Simplifier iteration=2 = {terms: 511, types: 539, coercions: 352, joins: 0/1} *** Core Linted result of Simplifier: Result size of Simplifier = {terms: 511, types: 539, coercions: 352, joins: 0/1} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 11.98 milliseconds, allocated 16.524 megabytes *** Exitification transformation [Bug]: Result size of Exitification transformation = {terms: 511, types: 539, coercions: 352, joins: 0/1} *** Core Linted result of Exitification transformation: !!! Exitification transformation [Bug]: finished in 1.89 milliseconds, allocated 3.182 megabytes *** Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = True}) [Bug]: Result size of Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = True}) = {terms: 511, types: 539, coercions: 352, joins: 0/1} *** Core Linted result of Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = True}): !!! Float out(FOS {Lam = Just 0, Consts = True, OverSatApps = True}) [Bug]: finished in 2.79 milliseconds, allocated 4.431 megabytes *** Common sub-expression [Bug]: Result size of Common sub-expression = {terms: 509, types: 539, coercions: 352, joins: 0/1} *** Core Linted result of Common sub-expression: !!! Common sub-expression [Bug]: finished in 2.41 milliseconds, allocated 3.707 megabytes *** Float inwards [Bug]: Result size of Float inwards = {terms: 509, types: 539, coercions: 352, joins: 0/1} *** Core Linted result of Float inwards: !!! Float inwards [Bug]: finished in 2.06 milliseconds, allocated 3.367 megabytes *** Simplifier [Bug]: Result size of Simplifier = {terms: 505, types: 537, coercions: 352, joins: 0/1} *** Core Linted result of Simplifier: !!! Simplifier [Bug]: finished in 4.38 milliseconds, allocated 5.316 megabytes *** Demand analysis [Bug]: Result size of Demand analysis = {terms: 505, types: 537, coercions: 352, joins: 0/1} *** Core Linted result of Demand analysis: !!! Demand analysis [Bug]: finished in 2.79 milliseconds, allocated 3.559 megabytes *** CoreTidy [Bug]: Result size of Tidy Core = {terms: 547, types: 802, coercions: 358, joins: 0/1} *** Core Linted result of Tidy Core: !!! CoreTidy [Bug]: finished in 3.54 milliseconds, allocated 4.984 megabytes Created temporary directory: /tmp/nix-shell.EmVGaD/ghc3059898_0 *** CorePrep [Bug]: Result size of CorePrep = {terms: 648, types: 1,073, coercions: 358, joins: 0/12} *** Core Linted result of CorePrep: !!! CorePrep [Bug]: finished in 4.41 milliseconds, allocated 4.674 megabytes *** CoreToStg [Bug]: *** Stg2Stg: !!! CoreToStg [Bug]: finished in 0.40 milliseconds, allocated 0.848 megabytes *** CodeGen [Bug]: !!! CodeGen [Bug]: finished in 16.99 milliseconds, allocated 20.930 megabytes *** systool:as: *** Assembler: /nix/store/bg35nfwn6zd616facdywiysgpprfvsji-gcc-wrapper-11.3.0/bin/cc -iquote. -no-pie -fno-PIC -x assembler -c /tmp/nix-shell.EmVGaD/ghc3059898_0/ghc_2.s -o Bug.o.tmp !!! systool:as: finished in 0.36 milliseconds, allocated 0.122 megabytes Upsweep completely successful. *** Deleting temp files: Deleting: /tmp/nix-shell.EmVGaD/ghc3059898_0/ghc_1.s /tmp/nix-shell.EmVGaD/ghc3059898_0/ghc_2.s /tmp/nix-shell.EmVGaD/ghc3059898_0/ghc_3.c Warning: deleting non-existent /tmp/nix-shell.EmVGaD/ghc3059898_0/ghc_1.s Warning: deleting non-existent /tmp/nix-shell.EmVGaD/ghc3059898_0/ghc_3.c link(batch): upsweep (partially) failed OR Main.main not exported; not linking. *** Deleting temp files: Deleting: *** Deleting temp dirs: Deleting: /tmp/nix-shell.EmVGaD/ghc3059898_0 ``` </details> ## Expected behavior Successfully and quietly compile, like any other module would. ## Environment * GHC version used: 9.2.2, 9.2.1, 9.0.2, 9.0.1, 8.10.7, 8.8.4 from nixpkgs-21.11 and nixpkgs-unstable <details><summary>A nix flake for reproducability:</summary> (run `nix run .#run-922` etc in a directory with the standalone `Bug.hs`). (For use with the one depending on `optics-core`, add `p.optics-core` to the `ghcWithPackages` list, but this only works on nixos-unstable due to needing optics-core 0.4) For nixpkgs-unstable: ``` { description = "A very basic flake"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; outputs = { self, nixpkgs }: let pkgs = import nixpkgs { system = "x86_64-linux"; }; defaultGhcVersion = "ghc922"; haskellPkgs = ghcVersion: pkgs.haskell.packages.${ghcVersion}; deps = ghcVersion: [ ((haskellPkgs ghcVersion).ghcWithPackages (p: [ ]))]; testScript = ghcVersion: pkgs.writeShellApplication { name = "test-${ghcVersion}"; runtimeInputs = deps ghcVersion; text = "ghc -O Bug.hs -fforce-recomp"; }; in { devShell.x86_64-linux = pkgs.mkShell { packages = deps defaultGhcVersion ;}; apps.x86_64-linux.run-default = testScript defaultGhcVersion; apps.x86_64-linux.run-884 = testScript "ghc884"; apps.x86_64-linux.run-8107 = testScript "ghc8107"; apps.x86_64-linux.run-902 = testScript "ghc902"; apps.x86_64-linux.run-922 = testScript "ghc922"; }; } ``` ``` { "nodes": { "nixpkgs": { "locked": { "lastModified": 1652172129, "narHash": "sha256-8e2JMrswaKe02P8rYfvIMoc59pNuw6h/GYu8DBE1c+0=", "owner": "NixOS", "repo": "nixpkgs", "rev": "f419dc5763c2b3c5580e396dea065b6d8b58ee27", "type": "github" }, "original": { "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { "nixpkgs": "nixpkgs" } } }, "root": "root", "version": 7 } ``` For nixos-21.11 ``` { description = "A very basic flake"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11"; outputs = { self, nixpkgs }: let pkgs = import nixpkgs { system = "x86_64-linux"; }; defaultGhcVersion = "ghc921"; haskellPkgs = ghcVersion: pkgs.haskell.packages.${ghcVersion}; deps = ghcVersion: [ ((haskellPkgs ghcVersion).ghcWithPackages (p: [ ]))]; testScript = ghcVersion: pkgs.writeShellApplication { name = "test-${ghcVersion}"; runtimeInputs = deps ghcVersion; text = "ghc -O App.hs -fforce-recomp"; }; in { devShell.x86_64-linux = pkgs.mkShell { packages = deps defaultGhcVersion ;}; apps.x86_64-linux.run-default = testScript defaultGhcVersion; apps.x86_64-linux.run-884 = testScript "ghc884"; apps.x86_64-linux.run-8107 = testScript "ghc8107"; apps.x86_64-linux.run-901 = testScript "ghc901"; apps.x86_64-linux.run-921 = testScript "ghc921"; }; } ``` ``` { "nodes": { "nixpkgs": { "locked": { "lastModified": 1651310835, "narHash": "sha256-MLk/zsLlbPhwFucxL64Fr+oIrvQC2/76Ap2F7ekbPNI=", "owner": "NixOS", "repo": "nixpkgs", "rev": "fd3e33d696b81e76b30160dfad2efb7ac1f19879", "type": "github" }, "original": { "owner": "NixOS", "ref": "nixos-21.11", "repo": "nixpkgs", "type": "github" } }, "root": { "inputs": { "nixpkgs": "nixpkgs" } } }, "root": "root", "version": 7 } ``` </details> Optional: * Operating System: NixOS * System Architecture: x86_64 However, a similar symptom has been noticed on an Apple Silicon mac in CI
issue