Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Not a Bug
-
10.5.18
-
None
Description
This is a cppcheck found item. Seems to be valid. Not 100% sure.
10.11 |
Checking storage/perfschema/pfs_global.cc: O_NONBLOCK=1;INT_MAX=0x7FFFFFFF;MAP_ANONYMOUS=1;__GNUC__=1;HAVE_CONFIG_H=1;MYSQL_SERVER=1;_FILE_OFFSET_BITS=64;NDEBUG=1;_FORTIFY_SOURCE=2;DBUG_OFF=1;HAVE_OPENSSL=1;OPENSSL_API_COMPAT=0x10100000L...
|
mariadb-server-10.11/sql/sql_bitmap.h:78:39: error: Shifting 64-bit value by 64 bits is undefined behaviour [shiftTooManyBits]
|
return ARRAY_ELEMENTS == 1 ? 1ULL << n : 1ULL << (n % BITS_PER_ELEMENT);
|
^
|
sql/sql_bitmap.h:190:53: note: Calling function 'last_element_mask', 1st argument '64' value is 64
|
buffer[ARRAY_ELEMENTS - 1]= last_element_mask(width);
|
^
|
mariadb-server-10.11/sql/sql_bitmap.h:83:21: note: Calling function 'bit_mask', 1st argument 'n' value is 64
|
return bit_mask(n) - 1;
|
^
|
mariadb-server-10.11/sql/sql_bitmap.h:78:39: note: Shift
|
return ARRAY_ELEMENTS == 1 ? 1ULL << n : 1ULL << (n % BITS_PER_ELEMENT);
|
^
|
What this doesn't show is sql_bitmask.h:77
DBUG_ASSERT(n < width);
|
So last_element_mask(width) - results in bit_mask(width) which misses the DBUG_ASSERT(n < width) in production builds.
This would get called in:
storage/maria/ha_maria.cc:ha_maria::info share->keys_in_use.intersect_extended(maria_info.key_map);
|
(and myisam in same way).
Attachments
Issue Links
- is caused by
-
MDEV-19702 Refactor Bitmap<N> to be based on ulonglong, not on uint32
- Closed