MPS issue job003875

TitleMMQA test function/45.c failure
Statusclosed
Prioritynice
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionOn platform xci6ll:

$ qa run function/45.c
% create arena: OK
% chain_create: OK
% 0 of 100
% ASSERTION FAILED
!assert=true
!asserttext=setref: to non-data object.
-----------------------------------------------------------------------------
FAILED TEST function/45.c

  harness = 1.0
  id =
    $Id: //info.ravenbrook.com/project/mps/master/test/function/45.c#5 $
  language = c
  link = testlib.o newfmt.o
  summary = arena_collect when lots of APs are in mid-cycle
SPECIFIED RESULTS
  completed = yes
MMQA OPTIONS
  MPS_INCLUDE_DIR = ../code
  MPS_LINK_OBJ = ../code/xci6ll/cool/mps.o
  MPS_PRODUCT = mps
  PLATFORM = Darwin_13.4.0_i386__unix
RESULTS
  assert = true
  asserttext = setref: to non-data object.
  seconds = 0
CONCLUSION
  FAIL failed on completed: wanted = yes, was absent
AnalysisIt seems that that the object in p[i] died after it was committed, even though it should have been kept alive by the reference in ambig[i] which is on the stack.

But ambig[i] was written to but never read, and so it seems that the compiler was free to optimize it away! Putting in a read to ambig[i] prevents this optimization and allows the test case to pass.

Test function/45.c is based on function/12.c and there's a worse problem in the latter: there are no ambiguous references keeping alive the objects being reserved/committed. This breaks the allocation point protocol, but presumably we are getting away with it because there are no collections.
How foundautomated_test
EvidenceNone.
Test procedurefunction/45.c
Created byGareth Rees
Created on2014-10-10 22:09:25
Last modified byGareth Rees
Last modified on2014-10-20 17:17:52
History2014-10-10 GDR Created.

Fixes

Change Effect Date User Description
187200 closed 2014-10-10 22:14:22 Gareth Rees In function/45.c, read from ambig[i] to prevent the compiler from optimizing away the array and so allowing p[i] to die.
In function/12.c, add a garbage collection to check that the allocation point protocol is being followed. Ensure there's an ambiguous reference to reserved objects before committin them.