Boost logo

Boost-Build :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2003-01-22 13:56:48

Dear Boost Jamers,

Our local Cray adminstrators (Bruno Loepfe from ETH and Olivier Byrde
from Cray) found a bug in the boost jam sources. it is in the file

char *b = (*data)->key;
int keyval;


keyval = *b;

while( *b )
keyval = keyval * 2147059363 + *b++;

keyval &= 0x7FFFFFFF;

This assumes that overflows are benign, and works only if int is 32
bit. It will not work on the Cray, where int is 64 bit, and with
optimization turned on actually 46 bit (on the Cray SV1 and some other
Crays integer operations will be performed in 46 bit arithmetic by
employing the floating point units). There are two proposed bug fixes:

a) change keyval to a short on the Crays where shorts are 32 bit

b) (the recommended and clean solution) change
keyval = keyval * 2147059363 + *b++;
keyval = ((keyval * 2147059363)) & 0xFFFFFFFF) + *b++;

On a 32 bit machine the & 0xFFFFFFFF should be optimized away by the
compiler and on the Cray it will ensure correct compilation.

Can somebody patch the boost source code to fix this bug?

Best regards,



Boost-Build list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at