[GHC] #14850: mallocBytes allows underflow

GHC ghc-devs at haskell.org
Mon Feb 26 20:08:19 UTC 2018


#14850: mallocBytes allows underflow
-------------------------------------+-------------------------------------
        Reporter:  wyager            |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  libraries/base    |              Version:  8.0.2
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Poor/confusing    |  Unknown/Multiple
  error message                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by hsyl20):

 I'm all in favor of using `Word` instead of `Int` but `mallocBytes` is
 part of Haskell2010
 ([https://www.haskell.org/onlinereport/haskell2010/haskellch31.html#x39-28700031.1
 Foreign.Marshal.Alloc]) so it's going to be painful to get the change
 accepted.

 If we ever do it, we can fix most other uses of `Int` in the report: e.g.,
 in
 [https://www.haskell.org/onlinereport/haskell2010/haskellch20.html#x28-22800020
 Data.List], in
 [https://www.haskell.org/onlinereport/haskell2010/haskellch15.html#x23-20800015
 Data.Bits], etc. We could also fix GHC's primitives (`unsafeShiftRL#`,
 etc.).

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


More information about the ghc-tickets mailing list