Optimizer creates stack overflow on filtered CAF
The following code creates a stack overflow at -O1 or -O2, when running with a moderately small stack (+RTS -K94k):
import Data.Bits hmm :: [Integer] hmm = filter (\n -> (n .&. (n-1))==0) [1..] main = mapM_ print hmm
The lambda just picks out powers of two, so that filter will skip increasingly long subsequences. It's the filter causing the overflow.
Changing hmm to [Int], or to be let-bound, or compiling with -O0 makes the overflow go away. Using a 95k stack also makes the overflow go away. (Below 95k, stack usage is linear with the length of the filtered-out subsequence; then it seems to cap out.)