Description
This bit of geo_validate.js fails on arm64:
assert.commandFailed(db.runCommand({geoNear: coll.getName(),
|
near: [0,0], spherical: true, num: NaN}));
|
Digging shows this to be because of this code in geo_near_cmd.cpp:
if (!eNumWanted.eoo()) {
|
uassert(17303, "limit must be number", eNumWanted.isNumber());
|
numWanted = eNumWanted.numberInt();
|
uassert(17302, "limit must be >=0", numWanted >= 0);
|
}
|
.numberInt() on a double just casts the double value to an int. Unfortunately, I think casting a NaN to an int is undefined behaviour. On intel you get INT_MIN but on arm64 (and probably other platforms from what I read) you get 0, a perfectly valid value in this context, and so the test fails.