Bug #57035 'ulonglong sql_mode' stored into ulong, is risky and causes compiler warning

Submitted: 27 Sep 2010 12:13 Modified: 12 Dec 2010 5:33
Reporter: Guilhem Bichot Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5, trunk, next-mr-bugfixing OS:Any
Assigned to: Jon Olav Hauglid CPU Architecture:Any

[27 Sep 2010 12:13] Guilhem Bichot
Description:
THD::variables::sql_mode is ulonglong. It used to be ulong (5.0, 5.1), but in 5.5 it was changed to ulonglong.
Some code which does
ulong save_sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode= blah;
...
thd->variables.sql_mode= save_sql_mode;
was unfortunately not updated: save_sql_mode should now be declared ulonglong, otherwise some bits of thd->variables.sql_mode could be lost. Currently it does not happen because we use only the 32 first bits of thd->variables.sql_mode, but one day it will happen.
And it causes compiler warnings on the Windows machines of pushbuild2 like:
32>.\event_db_repository.cc(625) : warning C4244: 'initializing' : conversion from 'ulonglong' to 'ulong', possible loss of data

How to repeat:
grep for "=.*sql_mode" in the sql directory and fix all ulong variables.
Note: this is very easy; please don't postpone to 2012.
[27 Sep 2010 21:43] MySQL Verification Team
Thank you for the bug report.
[29 Oct 2010 15:01] 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/122318

3349 Jon Olav Hauglid	2010-10-29
      Bug #57035 'ulonglong sql_mode' stored into ulong, is risky
                 and causes compiler warning
      
      In 5.5 THD::variables::sql_mode was changed from ulong to
      ulonglong. The problem was that several variables used to
      store sql_mode were still declared as ulong. This patch
      updates these declarations to ulonglong.
      
      No test case added.
[29 Nov 2010 13:44] 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/125346

3392 Jon Olav Hauglid	2010-11-29
      Bug #57035 'ulonglong sql_mode' stored into ulong, is risky
                 and causes compiler warning
      
      In 5.5 THD::variables::sql_mode was changed from ulong to
      ulonglong. The problem was that several variables used to
      store sql_mode were still declared as ulong. This patch
      updates these declarations to sql_mode_t which is typedef'ed
      to ulonglong.
      
      The patch also adds a test case designed to break once
      someone adds a new SQL mode. This is done to serve as an
      indication that current tests which use
      "SET @@sql_mode= cast(pow(2,32)-1" to activate all SQL modes
      will then have to be updated.
[29 Nov 2010 16:28] 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/125388

3393 Jon Olav Hauglid	2010-11-29
      Bug #57035 'ulonglong sql_mode' stored into ulong, is risky
                 and causes compiler warning
      
      In 5.5 THD::variables::sql_mode was changed from ulong to
      ulonglong. The problem was that several variables used to
      store sql_mode were still declared as ulong. This patch
      updates these declarations to sql_mode_t which is typedef'ed
      to ulonglong.
      
      The patch also adds a test case designed to break once
      someone adds a new SQL mode. This is done to serve as an
      indication that current tests which use
      "SET @@sql_mode= cast(pow(2,32)-1" to activate all SQL modes
      will then have to be updated.
[29 Nov 2010 16:32] Jon Olav Hauglid
Pushed to mysql-trunk-bugfixing (5.6.1-m5).
[29 Nov 2010 18:50] 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/125414

3396 Luis Soares	2010-11-29
      BUG#57035: 'ulonglong sql_mode' stored into ulong, is risky
                  and causes compiler warning
      
      Post-push fix.
[5 Dec 2010 12:38] Bugs System
Pushed into mysql-trunk 5.6.1 (revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (version source revid:alexander.nozdrin@oracle.com-20101205122447-6x94l4fmslpbttxj) (merge vers: 5.6.1) (pib:23)
[12 Dec 2010 5:33] Paul DuBois
Code cleanup. No changelog entry needed.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.066 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.