
#13425: Semantically-equivalent expressions evaluating at different values with -O1 -------------------------------------+------------------------------------- Reporter: rbasso | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by dfeuer): Reid thinks he's found the ultimate source, in an optimization he made intended to help with tag bit checks. Here's a greatly reduced reproduction case: {{{#!hs import Data.Bits ((.&.)) flags :: Int -> Int flags x | x .&. 128 > 0 = 12 | otherwise = 13 {-# NOINLINE flags #-} main :: IO () main = print (flags 255) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13425#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler