id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc,os,architecture,failure,difficulty,testcase,blockedby,blocking,related
5626,"Miscompilation, exception omitted with -O",michal.palka,simonpj,"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.",bug,closed,high,7.4.1,Compiler,7.3,fixed,strictness strict exception miscompilation,michal.palka@…,Unknown/Multiple,Unknown/Multiple,Incorrect result at runtime,,codeGen/should_run/5626,,,
