[GHC] #7866: floor (0/0) :: Int is different with -O0 and -O1

GHC ghc-devs at haskell.org
Fri Sep 20 16:19:39 CEST 2013


#7866: floor (0/0) :: Int is different with -O0 and -O1
------------------------------------------------+--------------------------
        Reporter:  alang9                       |            Owner:
            Type:  bug                          |           Status:  closed
        Priority:  normal                       |        Milestone:
       Component:  Compiler                     |          Version:  7.6.2
      Resolution:  invalid                      |         Keywords:
Operating System:  Linux                        |     Architecture:  x86_64
 Type of failure:  Incorrect result at runtime  |  (amd64)
       Test Case:                               |       Difficulty:
        Blocking:                               |  Unknown
                                                |       Blocked By:
                                                |  Related Tickets:
------------------------------------------------+--------------------------

Comment (by bgamari):

 Interestingly enough building with `-O1 -fllvm` also results in `0`.
 However, it seems this is only accidental as the conversion is lowered to
 `%ln1JE = fptosi double %ln1JD to i64` in LLVM IR which is undefined when
 the source can't fit in the destination type.

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



More information about the ghc-tickets mailing list