Bug #29079 Semantics of "bigint" depend on platform specifics (size, signedness of char ?)
Submitted: 13 Jun 2007 16:40 Modified: 10 Jul 2007 22:51
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Types Severity:S3 (Non-critical)
Version:4.1.23 OS:Other (AIX + Solaris(Sparc) 64 bit)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[13 Jun 2007 16:40] Joerg Bruehe
Description:
Occurred during 4.1.23 release builds:

-------------------------------------------------------
*** r/select.result
--- r/select.reject
***************
*** 2828,2838
  Warning       1264    Data truncated; out of range for column 'b' at row 1
  Warning       1264    Data truncated; out of range for column 'a' at row 2
  Warning       1264    Data truncated; out of range for column 'b' at row 2
- Warning       1264    Data truncated; out of range for column 'b' at row 3
  select hex(a), hex(b) from t1;
  hex(a)        hex(b)
  FFFFFFFFFFFFFFFF      7FFFFFFFFFFFFFFF
  FFFFFFFFFFFFFFFF      7FFFFFFFFFFFFFFF
! 8FFFFFFFFFFFFFFF      7FFFFFFFFFFFFFFF
  drop table t1;
  End of 4.1 tests
--- 2828,2837
  Warning       1264    Data truncated; out of range for column 'b' at row 1
  Warning       1264    Data truncated; out of range for column 'a' at row 2
  Warning       1264    Data truncated; out of range for column 'b' at row 2
  select hex(a), hex(b) from t1;
  hex(a)        hex(b)
  FFFFFFFFFFFFFFFF      7FFFFFFFFFFFFFFF
  FFFFFFFFFFFFFFFF      7FFFFFFFFFFFFFFF
! 8FFFFFFFFFFFFFFF      8FFFFFFFFFFFFFFF
  drop table t1;
  End of 4.1 tests
-------------------------------------------------------

Occurred in all configurations, all tests,
on the 64 bit versions of AIX and Solaris 8, 9, and 10 (Sparc-64).

This part of the test was added with the fix of bug#22533.

I suspect this may be an issue of "char" being by default signed vs unsigned.

How to repeat:
Found by running the test suite.
[20 Jun 2007 7:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/29154

ChangeSet@1.2667, 2007-06-20 12:40:35+05:00, ramil@mysql.com +1 -0
  Fix for bug #29079: Semantics of "bigint" depend on platform specifics (size, signedness of char ?)
  
  Problem: comparing a big ulonglong variable with a longlong constant may depend on compiler used
  and lead to unexpected results.
  Fix: use explicit type cast.
[22 Jun 2007 13:08] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/29394

ChangeSet@1.2667, 2007-06-22 17:12:40+05:00, ramil@mysql.com +1 -0
  Fix for bug #29079: Semantics of "bigint" depend on platform specifics (size, signedness of char ?)
  
  Problem: long and long long types mess in a comparison may lead to wrong results on some platforms.
  Fix: prefer [unsigned] long long as [u]longlong as it's used unconditionally in many places.
[10 Jul 2007 13:27] Bugs System
Pushed into 5.1.21-beta
[10 Jul 2007 13:28] Bugs System
Pushed into 5.0.46
[10 Jul 2007 13:29] Bugs System
Pushed into 4.1.24
[10 Jul 2007 22:51] Paul DuBois
Noted in 4.1.24, 5.0.46, 5.1.21 changelogs.

The semantics of BIGINT depended on platform-specific characteristics.