`filter (const False)` leaks with -O2
See also
Summary
Program:
main = print $ filter (const False) [0..]
leaks when compiled with ghc -O2
. It doesn't leak when compiled with ghc -O0
Steps to reproduce
$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.8.1
$ ghc -O2 Test.hs
$ ./Test
Expected behavior
When compiled with -O2
and run it should loop with constant space.
Environment
- GHC version used: 9.8.1, 9.4.8
Optional:
- Operating System: NixOS 23.11.750.7c4c20509c43 (Tapir)
- System Architecture: x86_64 Intel(R) Core(TM) i5-2520M