Fix trac #10413
ClosedPublic

Authored by fryguybob on Aug 31 2015, 6:08 PM.

Details

Summary

The offset for the pointer count field for small arrays is in bytes but is used in two places to make a word offset. This only works because the offset is zero.

Test Plan

Validate.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
fryguybob updated this revision to Diff 3997.Aug 31 2015, 6:08 PM
fryguybob retitled this revision from to Fix trac #10413.
fryguybob updated this object.
fryguybob edited the test plan for this revision. (Show Details)
fryguybob added a reviewer: tibbe.
fryguybob set the repository for this revision to rGHC Glasgow Haskell Compiler.
fryguybob updated the Trac tickets for this revision.
tibbe accepted this revision.Aug 31 2015, 7:16 PM
tibbe edited edge metadata.

Yikes! Good catch. Could you please add a test?

bgamari accepted this revision.Sep 1 2015, 8:06 AM
bgamari edited edge metadata.

Wow, very good catch indeed. A test would be great.

bgamari accepted this revision.Sep 2 2015, 3:56 AM

Hmm, it's actually not entirely clear to me how this could easily be tested given that oFFSET_StgMutArrPtrs_ptrs can't really be easily changed from zero.

I'm going to merge this as is. Feel free to open a new Diff adding a test if either of you think of one.

This revision was automatically updated to reflect the committed changes.

I was scratching my head a bit thinking about how to write a meaningful test. I think if the offset had changed before this fix, the sizeofSmallArray test would have caught it.