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

Undefined symbol linking error when using static pointers (only with optimisations)
See also * #16981 Attempting to compile the following program into an executable with any recent GHC (9.2, 9.4, 9.6, 9.8) causes a linker error: ```haskell {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE StaticPointers #-} {-# OPTIONS_GHC -O1 #-} module Main where -- base import Control.Monad ( ap ) import GHC.StaticPtr ( StaticPtr ) -------------------------------------------------------------------------------- newtype ReaderIO a = ReaderIO { runReaderIO :: () -> IO a } deriving stock Functor instance Applicative ReaderIO where pure a = ReaderIO $ \ _ -> pure a (<*>) = ap instance Monad ReaderIO where m >>= k = ReaderIO $ \ r -> do a <- runReaderIO m r runReaderIO (k a) r {-# NOINLINE uhoh #-} uhoh :: ReaderIO () uhoh = do let ptr :: StaticPtr ( IO () ) ptr = static ( return () ) _ <- ReaderIO $ \ _ -> return () ptr `seq` return () main :: IO () main = putStrLn "Hello, Haskell!" ``` ``` ld.lld: error: undefined symbol: r1vI_closure >>> referenced by Main.o(ghc_3.o):(.refptr.r1vI_closure) clang: error: linker command failed with exit code 1 (use -v to see invocation) ghc-9.8.2.exe: `clang.exe' failed in phase `Linker'. (Exit code: 1) ``` Note that this bug goes away if one disables optimisations with `-O0`.
issue