Bug #60908 Coding technique leads to compilation warnings on 32-bit platforms
| Submitted: | 18 Apr 2011 20:25 | Modified: | 27 Feb 2013 12:47 |
|---|---|---|---|
| Reporter: | Paul Green (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Compiling | Severity: | S3 (Non-critical) |
| Version: | 5.6.2-m5 | OS: | Any |
| Assigned to: | Tor Didriksen | CPU Architecture: | Any |
| Tags: | Contribution | ||
[18 Apr 2011 20:27]
Paul Green
Patches to correct 32-bit compilation warnings.
Attachment: mysql.60908.diff (application/octet-stream, text), 2.32 KiB.
[27 Apr 2011 8:03]
Valeriy Kravchuk
Thank you for the problem report and code contributed.
[27 Feb 2013 12:47]
Tor Didriksen
This has been fixed in 5.6 with the patch for Bug#12561303 InnoDB file API uses two parameters for file size
[1 Mar 2013 15:35]
Paul DuBois
Noted in 5.6.3 changelog. Fixed "shift count greater than width of type" compilation warnings.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.054 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.
Description: A coding technique used by some MySQL programs leads to compilation warnings on 32-bit platforms. A trivial recoding can eliminate the warnings. The following technique produces "shift count greater than width of type" error messages (on the right-shift operator): if (sizeof (off_t) > 4) { *size = (ulint)(offs & 0xFFFFFFFFUL); *size_high = (ulint)(offs >> 32); } else { *size = (ulint) offs; *size_high = 0; } Since only one of these two cases can possibly arise on any given platform and since the appropriate case can be determined at compile-time, the following recoding eliminates the warning. #if SIZEOF_OFF_T > 4 /* same as above */ #else /* same as above */ #endif Error messages: /ssp/mysql/rebuild.2.0/mysql/storage/innobase/os/os0file.c: In function `os_file_get_size': /ssp/mysql/rebuild.2.0/mysql/storage/innobase/os/os0file.c:1715: warning: right shift count >= width of type /ssp/mysql/rebuild.2.0/mysql/storage/innobase/os/os0file.c: In function `os_file_pread': /ssp/mysql/rebuild.2.0/mysql/storage/innobase/os/os0file.c:2026: warning: left shift count >= width of type /ssp/mysql/rebuild.2.0/mysql/storage/innobase/os/os0file.c: In function `os_file_pwrite': /ssp/mysql/rebuild.2.0/mysql/storage/innobase/os/os0file.c:2111: warning: left shift count >= width of type How to repeat: I ran into this problem building MySQL 5.1.48 on the Stratus OpenVOS operating system, Release 17.1. I have verified that the code in question still exists in MySQL 5.6.2-m5. We are using gcc version 3.4.6, with the compilation warnings set to the MySQL default values (no extra -W flags have been specified). I will attach a patch file to this bug report that corrects the errors that I encountered. In theory, you should be able to reproduce this gcc warning message by simply building MySQL on a 32-bit platform. Suggested fix: I will attach a patch file that is valid for mysql-5.6.2-m5. It is based on identical changes that I made to mysql 5.1.48.