MPS issue job003848

TitleAccess violation in gcbench on Windows
Statusopen
Priorityoptional
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionSee [1]. On platform W3I6MV:

    $ w3i6mv/hot/gcbench.exe -x 1763120249 -a 65536 amc
    seed: 1763120249
    The MPS detected a problem!
    lockw3.c:78: MPS ASSERTION FAILED: lock->claims == 0
AnalysisWhen running inside vsjitdebugger, I don’t hit the above assertion, but instead I get an access violation in dylan_scan1 (inside ArenaAccess). Examination of the arena shows that insideShield is false even though ArenaAccess is on the stack and so we should have just call ShieldEnter.

The bug is still reproducible with /O1 but not with /Od.

The bug doesn't depend on setting the -a option. It is reproducible with:

    $ w3i6mv/hot/gcbench.exe -x 1763120249 amc

On platform w3i3mv it can be reproduced with seed 1552443801.

Going back through the history, it seems that gcbench has always been broken on Windows, ever since we ported it in change 185354.

More analysis in [2] [3] [4] [5] [6] [7] [8].

Summary: with the /Og /Oy /Ob2 compiler flags, Microsoft Visual C/C++ compiles the function mkvector so that it "encrypts" the only pointer to an object, meaning that it is not recognized by the MPS's scanner, causing the object to die. (The "encryption" involves taking two pointers p and q and replacing q with q-p.) So this is not a bug in the MPS, but a limitation in what conservative garbage collection can do when faced with a sufficiently clever compiler.
How foundmanual_test
Evidence[1] https://info.ravenbrook.com/mail/2014/06/30/16-17-14/0/
[2] https://info.ravenbrook.com/mail/2014/07/02/10-33-42/0/
[3] https://info.ravenbrook.com/mail/2014/07/03/11-34-55/0/
[4] https://info.ravenbrook.com/mail/2014/07/03/13-37-40/0/
[5] https://info.ravenbrook.com/mail/2014/07/03/14-11-18/0/
[6] https://info.ravenbrook.com/mail/2014/07/03/14-36-05/0/
[7] https://info.ravenbrook.com/mail/2014/07/03/15-07-53/0/
[8] https://info.ravenbrook.com/mail/2014/07/03/15-37-42/0/
Created byGareth Rees
Created on2014-07-01 11:16:04
Last modified byGareth Rees
Last modified on2016-09-13 10:44:36
History2014-07-01 GDR Created.