Code using seq has wrong strictness (too lazy) when optimised
Following program prints [1] instead of crashing when compiled with -O -fno-full-laziness. Note that it's neccessary to use the extra definition hiddenError instead of calling error directly. The problem might be related to #5557 (closed), which, however, has already been fixed and optimisation is needed to trigger the current bug.
hiddenError = error "hidden error"
main = do
print $ seq (head (map (\a -> \b -> hiddenError) (hiddenError::[] Bool))) id [1]
I used GHC 7.3.20111022 for triggering this problem.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | michal.palka@poczta.fm |
| Operating system | |
| Architecture |