#8867: newArray# fails to initialize card table correctly -------------------------------------+------------------------------------ Reporter: tibbe | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by Johan Tibell <johan.tibell@…>): In [changeset:"46d05ba03d1491cade4a3fe33f0b8c404ad3c760/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="46d05ba03d1491cade4a3fe33f0b8c404ad3c760" Fix two issues in stg_newArrayzh The implementations of newArray# and newArrayArray#, stg_newArrayzh and stg_newArrayArrayzh, had three issues: * The condition for the loop that fills the array with the initial element was incorrect. It would write into the card table as well. The condition for the loop that filled the card table was never executed, as its condition was also wrong. In the end this didn't lead to any disasters as the value of the card table doesn't matter for newly allocated arrays. * The card table was unnecessarily initialized. The card table is only used when the array isn't copied, which new arrays always are. By not writing the card table at all we save some cycles. * The ticky allocation accounting was wrong. The second argument to TICK_ALLOC_PRIM is the size of the closure excluding the header size, but the header size was incorrectly included. Fixes #8867. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8867#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler