MPS issue job003874

TitleMMQA test function/214.c failure
Statusclosed
Prioritynice
Assigned userGareth Rees
OrganizationRavenbrook
DescriptionThe test case passes on OS X, but on Ubuntu (platform lii6ll) the call to mps_pool_create returns ResMEMORY.
AnalysisLooking at it in the debugger shows that MVTInit is getting a ridiculously large value for the reserveDepth argument, and so the call to ABQInit is failing becaue it can't allocate the array of elements.

The problem is that the call looks like this:

    mps_pool_create(&pool, arena, mps_class_mvt(),
                    OBJSIZE, OBJSIZE, OBJSIZE, DEPTH, FRAGLIMIT),

where OBJSIZE and so on are preprocessor constants that expand to integer literals (and are small enough that they have type int), and then the default argument promotions are applied since mps_pool_create has a variable argument list, so they are passed as 32-bit integers. But MVTVarargs decodes these arguments as Size, Size, Size, Count, Count, respectively, which are all 64-bit types on this platform, and so read off the end of the argument list into nearby memory.

How did this test case pass on OS X? Maybe we just got lucky wrt the contents of the nearby memory.
How foundautomated_test
EvidenceNone.
Test procedurefunction/214.c
Created byGareth Rees
Created on2014-10-10 19:58:24
Last modified byGareth Rees
Last modified on2014-10-20 17:18:15
History2014-10-10 GDR Created.

Fixes

Change Effect Date User Description
187190 closed 2014-10-10 17:14:09 Gareth Rees Cast arguments to the correct type to avoid them being decoded incorrectly by the varargs interface.