mirror of
https://github.com/MariaDB/server.git
synced 2026-04-26 10:15:29 +02:00
Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations. Another rather noisy violation of strict aliasing rules is the spatial code which makes use of stack-based memory (of type Geometry_buffer) to provide placement for Geometry objects. Although a placement new is allowed to dynamically change the type of a object, the object returned by the new placement was being ignored and the original stack-based object was being casted to the new type, thus violating strict aliasing rules. The solution is to reorganize the code so that the object returned by the new placement is used instead of casting the original object. Also, to ensure that the stack-based object is properly aligned with respect to the objects it provides placement for, a set of compiler-dependent macros and types are introduced so that the alignment of objects can be inquired and specified.
This commit is contained in:
parent
dbef812ab9
commit
21f63caf8e
6 changed files with 166 additions and 41 deletions
|
|
@ -2202,8 +2202,8 @@ static bool show_status_array(THD *thd, const char *wild,
|
|||
bool ucase_names,
|
||||
COND *cond)
|
||||
{
|
||||
MY_ALIGNED_BYTE_ARRAY(buff_data, SHOW_VAR_FUNC_BUFF_SIZE, long);
|
||||
char * const buff= (char *) &buff_data;
|
||||
my_aligned_storage<SHOW_VAR_FUNC_BUFF_SIZE, MY_ALIGNOF(long)> buffer;
|
||||
char * const buff= buffer.data;
|
||||
char *prefix_end;
|
||||
/* the variable name should not be longer than 64 characters */
|
||||
char name_buffer[64];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue