MPS issue job003436

Titleawlut test failure
Statusclosed
Priorityessential
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionOn OS X:

    $ code/xc/Release/awlut 938401525
    code/xc/Release/awlut: randomize(): resetting initial state (v3) to: 938401525.
    Strongly unreachable weak table entry found, slot 48.
AnalysisThis test case fails in the HOT variety on OS X for about 20% of random states, but I didn't find any failures in the COOL variety after running

    $ while code/xc/Debug/awlut; do sleep 1; done

for 250 iterations, nor did I find any failures on Ubuntu in either variety.

I note that when the test case fails, it's always slot 48 (the last slot in the table) that has wrongly been kept alive. Moreover, when I edit the test case so that the last slot is never preserved:

- if (rnd() % 2 == 0) {
+ if (rnd() % 2 == 0 && i + 1 != TABLE_SLOTS) {

the test case now always fails (in the HOT variety on OS X). This strongly suggests that this slot is being kept alive by a local variable in the function. The test case is designed so that the local variable "string" is overwritten later, but on looking at the disassembly in GDB, it appears that LLVM has optimized away the local variable assignment.

So there's no bug in the MPS. It's just a test case that isn't robust against LLVM's aggressive optimization.

I made the test case reliable again, but ensuring that the last entry in the table is always preserved:

+ if (rnd() % 2 == 0 || i + 1 == TABLE_SLOTS) {

which makes sure that the local variable is overwritten.
How foundautomated_test
EvidenceNone.
Observed in1.110.0
Created byGareth Rees
Created on2013-03-08 10:09:04
Last modified byRichard Brooksby
Last modified on2016-03-05 12:31:32
History2013-03-08 GDR Created.

Fixes

Change Effect Date User Description
189640 closed 2016-03-05 12:13:53 Richard Brooksby Populating awlut's tables in a thread to ensure there are no references left in registers.

Imported from Git
 Author: Richard Brooksby <rb@ravenbrook.com> 1457179742 +0000
 Committer: Richard Brooksby <rb@ravenbrook.com> 1457179742 +0000
 sha1: 606e90b60111449bc1a6bc28169142cbcb4187b9
 push-state: complete
 parent-changes: 0e17e88d94b1f7a23b0a0e3af959fb8cf12a7196=[189639]
181088 closed 2013-03-08 11:36:38 Gareth Rees Ensure that the last entry in the table is preserved, so that we don't get a false positive due to the local variable 'string' keeping this entry alive.