Ticket #3677 (closed bug: fixed)
Optimizer creates stack overflow on filtered CAF
| Reported by: | jpet | Owned by: | simonpj |
|---|---|---|---|
| Priority: | normal | Milestone: | 6.12.2 |
| Component: | Compiler | Version: | 6.10.4 |
| Keywords: | Cc: | ||
| Operating System: | Windows | Architecture: | x86 |
| Type of failure: | Runtime crash | Difficulty: | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description (last modified by igloo) (diff)
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.)
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

