[GHC] #9416: newArray# incorrectly inlines big arrays (overflow1.hs SIGSEGVS on ./validate --slow)

GHC ghc-devs at haskell.org
Tue Aug 12 20:13:27 UTC 2014


#9416: newArray# incorrectly inlines big arrays (overflow1.hs SIGSEGVS on
./validate --slow)
-------------------------------------+-------------------------------------
              Reporter:  slyfox      |            Owner:  tibbe
                  Type:  bug         |           Status:  patch
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.8.3
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Easy (less than 1
       Type of failure:              |  hour)
  None/Unknown                       |       Blocked By:
             Test Case:              |  Related Tickets:
              Blocking:              |
Differential Revisions:  D128        |
-------------------------------------+-------------------------------------

Comment (by Johan Tibell <johan.tibell@…>):

 In [changeset:"6f862dfae20afdcd671133f3534b1bf5c25bbd9b/ghc"]:
 {{{
 #!CommitTicketReference repository="ghc"
 revision="6f862dfae20afdcd671133f3534b1bf5c25bbd9b"
 shouldInlinePrimOp: Fix Int overflow

 There were two overflow issues in shouldInlinePrimOp. The first one is
 due to a negative CmmInt literal being created if the array size was
 given as larger than 2^63-1 (on a 64-bit platform.) This meant that
 large array sizes could compare as being smaller than
 maxInlineAllocSize.

 The second issue is that we casted the Integer to an Int in the
 comparison, which again meant that large array sizes could compare as
 being smaller than maxInlineAllocSize.

 The attempt to allocate a large array inline then caused a segfault.

 Fixes #9416.
 }}}

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


More information about the ghc-tickets mailing list