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

GHC ghc-devs at haskell.org
Fri Aug 8 10:03:13 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):

 It looks like the overflow isn't in `shouldInlinePrimOp` (although that
 function should be fixed too) but in the code that create the `CmmInt`
 literal. Adding this tracing

 {{{
 shouldInlinePrimOp dflags NewByteArrayOp_Char [(CmmLit (CmmInt n _))]
   | n <= fromIntegral (maxInlineAllocSize dflags) = trace ("matches " ++
 show n) $
 }}}

 shows that `n` is -40, even thought it's an Integer, suggesting that the
 wrap-around happened elsewhere.

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


More information about the ghc-tickets mailing list