1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Attempt to work around a bug in the Borland BCC 5.5.1 compiler. Ticket #2880. (CVS 4705)

FossilOrigin-Name: 6de0ee49073c7a47d5e10495b569b33df76d1448
This commit is contained in:
drh
2008-01-11 00:06:10 +00:00
parent 2d401ab8f9
commit efe3d656b6
3 changed files with 26 additions and 7 deletions

View File

@@ -355,7 +355,26 @@ double sqlite3VdbeRealValue(Mem *pMem){
void sqlite3VdbeIntegerAffinity(Mem *pMem){
assert( pMem->flags & MEM_Real );
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
/* It is reported (in ticket #2880) that the BCC 5.5.1 compiler
** will corrupt a floating point number on the right-hand side
** of an assignment if the lvalue for the assignment is an integer.
**
** We will attempt to work around this bug in the Borland compiler
** by moving the value into a temporary variable first so that if
** the assignment into the integer really does corrupt the right-hand
** side value, it will corrupt a temporary variable that we do not
** care about.
*/
#ifdef __BORLANDC__
{
double r = pMem->r;
pMem->u.i = r;
}
#else
pMem->u.i = pMem->r;
#endif
if( ((double)pMem->u.i)==pMem->r ){
pMem->flags |= MEM_Int;
}