[GHC] #9238: Negative zero broken

GHC ghc-devs at haskell.org
Tue Jul 29 01:28:01 UTC 2014


#9238: Negative zero broken
-------------------------------------+-------------------------------------
              Reporter:  augustss    |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.8.2
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:  Incorrect   |       Blocked By:
  result at runtime                  |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------

Comment (by rwbarton):

 When we do
 {{{
     case ds1 of wild_XT {   -- ds1 :: Double#   (y = D# ds1)
       __DEFAULT -> ...
       0.0 -> ...
     }
 }}}
 inside the `0.0` case we seem to create a local unfolding `ds1 = 0.0`. You
 can see this happening with `-dverbose-core2core -ddump-inlinings`: search
 for "Inlining done: x" or "ds1".

 This is wrong because the `0.0` case matches both positive and negative
 zero. That is the correct semantics that makes the Core match the original
 program, and it is implemented correctly by the code generation. But it
 means that we can't create this local unfolding when the pattern is
 specifically `0.0`.

 I don't know where this unfolding gets created, or I'd try to fix it
 myself.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9238#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list