[GHC] #16111: Inconsistent behavior of Data.Bits.shiftL with different optimization levels and -fllvm

GHC ghc-devs at haskell.org
Wed Jan 9 23:29:15 UTC 2019


#16111: Inconsistent behavior of Data.Bits.shiftL with different optimization
levels and -fllvm
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.6.3
      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 RyanGlScott):

 Without knowing anything about the implementation details of
 `shiftL`/`shiftR`, my hope would be that invoking them with a negative
 number of bits would throw an exception, regardless of the optimization
 level. I could certainly envision that an unsafe primop like
 `uncheckedShiftL#` would have undefined behavior if given a negative
 number of bits as an argument, but it feels like we should be able to do
 better for `shiftL`.

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


More information about the ghc-tickets mailing list