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

GHC ghc-devs at haskell.org
Fri Aug 8 10:08:51 UTC 2014


#9416: newArray# incorrectly inlines big arrays (overflow1.hs SIGSEGVS on
./validate --slow)
-------------------------------------+-------------------------------------
              Reporter:  slyfox      |            Owner:  tibbe
                  Type:  bug         |           Status:  new
              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:              |
-------------------------------------+-------------------------------------

Comment (by tibbe):

 The core confirms my suspicions:

 {{{
 case GHC.Prim.newByteArray# @ GHC.Prim.RealWorld (-40) s1_a1Cc
 }}}

 The only workaround I can think of is quite unpleasant. We need to cast
 the `Integer` in the `CmmInt` to a `Word`(and then perhaps back to an
 `Integer`) to get rid of the 2-complement interpretation of the value.

 The real fix is to change `newByteArray#` to take the size as a `Word#`.

 I don't see how the overflow1 test ever passed.

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


More information about the ghc-tickets mailing list