> Hi!
>
> It seems definitely that it is a bug, which should be looked into.
hrm.
more info:
egcs-1.1.2:
Breakpoint 3, Field_long::store (this=0x11e2840, nr=0x0000000000000001)
at field.cc:1207
1207 if (unsigned_flag)
(gdb) s
1209 if (nr < 0)
(gdb) print nr
$1 = 0x0000000000000001
(gdb) s
1214 else if (nr > (longlong) (uint32) ~0L)
(gdb)
1216 uint32 tmp=(uint32) ~0L;
(gdb)
1217 longstore(ptr,tmp);
(gdb) print tmp
$2 = 4294967295
(gdb) print nr
$3 = 0x0000000000000001
egcs-1.1b:
Breakpoint 1, Field_long::store (this=0x1cb6b0, nr=0x0000000000000001)
at field.cc:1207
1207 if (unsigned_flag)
(gdb) s
1209 if (nr < 0)
(gdb)
1214 else if (nr > (longlong) (uint32) ~0L)
(gdb) print nr
$1 = 0x0000000000000001
(gdb) s
1221 longstore(ptr,(uint32) nr);
i looked at the sparc machine code. seems to me that
egcs-1.1.2 is generating code for a signed compare.
i wrote this chunk of test code based on sql/field.cc line 1207...
#include "mysql_priv.h"
#include "sql_select.h"
#include <m_ctype.h>
#include <errno.h>
#ifdef HAVE_FCONVERT
#include <floatingpoint.h>
#endif
main() {
longlong bar = 0x0000000000000001;
uint32 foo = (uint32) ~0L;
printf("foo:%u (%d)\n",foo,sizeof(foo));
printf("bar:%u (%d)\n",bar,sizeof(bar));
if ( bar > (longlong) (uint32) ~0L) {
printf("screwey\n");
}
}
this, likewise, exhibits that behavior.
however, if you change:
if ( bar > (longlong) (uint32) ~0L)
to:
if ( (uint32) bar > (uint32) ~0L)
the problem goes away.
i'll leave the potential semantic argument for you folks... ;-)
thanks,
--/\ndy