Miscompilation, exception omitted with -O
Following program is miscompiled when compiled with -O.
module Main where
wrap x = [x]!!0
f :: [Int] -> a
f a = foldr (\b -> \c -> c) (undefined ()) (a ++ a) 0
main = do
print $ (f [] :: String)
print $ wrap $ (f [] :: Int)
print $ wrap $ (f [] :: (Int, Int, Int, Int))
The result of running it on my machine (Linux x86-64) is following:
"
1099511628032
zsh: segmentation fault ./test7
Looking at the Core it seems that instead of the expected undefined a partially-applied function is returned. GHC 7.3.20111022 was used for testing.
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 |