#13425: Semantically-equivalent expressions evaluating at different values with -O1 -------------------------------------+------------------------------------- Reporter: rbasso | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: 8.2.1 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): Phab:D3359 Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ben Gamari <ben@…>): In [changeset:"caf94b062a0e37ffa7048e51447fc9486b658917/ghc" caf94b06/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="caf94b062a0e37ffa7048e51447fc9486b658917" x86 nativeGen: Fix test with mask in range [128,255] (#13425) My commit bdb0c43c7 optimized the encoding of instructions to test tag bits, but it did not always set exactly the same condition codes since the testb instruction does a single-byte comparison, rather than a full-word comparison. It would be correct to optimize the expression `x .&. 128 > 0` to the sequence testb $128, %al seta %al ; note: 'a' for unsigned comparison, ; not 'g' for signed comparison but the pretty-printer is not the right place to make this kind of context-sensitive optimization. Test Plan: harbormaster Reviewers: trofi, austin, bgamari, dfeuer Reviewed By: trofi, dfeuer Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D3359 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13425#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler