Ticket #7364 (closed bug: wontfix)
`foo !f = id . f` becomes non-strict with -O2
| Reported by: | shachaf | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | _|_ |
| Component: | Compiler | Version: | 7.6.1 |
| Keywords: | Cc: | ||
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Incorrect result at runtime | Difficulty: | Unknown |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description
The following program:
foo :: (a -> b) -> a -> b foo !f = id . f main :: IO () main = print (foo undefined `seq` "ok")
Crashes with Prelude.undefined when compiled without -O2, but prints "ok" with it. As far as I can tell the optimizer shouldn't be allowed to do that.
Change History
Note: See
TracTickets for help on using
tickets.
