GHC 9.8.1 crashes with `heap overflow` while deriving `Data` on Windows if both `-O -XHaskell2010` are enabled
Summary
I replaced the code below because I found a much much smaller reproduction.
code\Only-0.1 via λ 9.8.1
❯ /c/ghcup/bin/ghc-9.8.1 -fforce-recomp src/Data/Tuple/Only.hs -XHaskell2010
[1 of 1] Compiling Data.Tuple.Only ( src\Data\Tuple\Only.hs, src\Data\Tuple\Only.o )
code\Only-0.1 via λ 9.8.1
➜ /c/ghcup/bin/ghc-9.8.1 -fforce-recomp src/Data/Tuple/Only.hs -O
[1 of 1] Compiling Data.Tuple.Only ( src\Data\Tuple\Only.hs, src\Data\Tuple\Only.o )
code\Only-0.1 via λ 9.8.1
➜ /c/ghcup/bin/ghc-9.8.1 -fforce-recomp src/Data/Tuple/Only.hs -XHaskell2010 -O
[1 of 1] Compiling Data.Tuple.Only ( src\Data\Tuple\Only.hs, src\Data\Tuple\Only.o )
ghc-9.8.1.exe: heap overflow
code\Only-0.1 via λ 9.8.1
➜ cat src/Data/Tuple/Only.hs
{-# LANGUAGE DeriveDataTypeable #-}
module Data.Tuple.Only where
import Data.Data (Data)
data Only a = Only deriving (Data)
Steps to reproduce
ghcup install ghc 9.8.1 --set
ghcup install cabal 3.10.2.1 --set
cat <<EOF > Only.hs
{-# LANGUAGE DeriveDataTypeable #-}
module Only where
import Data.Data (Data)
data Only a = Only deriving (Data)
EOF
ghc Only.hs -XHaskell2010 -O
Environment
- GHC version used: 9.8.1
Optional:
- Operating System: Windows:
MINGW64_NT-10.0-22631 ... 3.4.10.x86_64 2023-12-22 10:06 UTC x86_64 Msys
- System Architecture: x86_64
Edited by Javier Sagredo