mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations. One somewhat major source of strict-aliasing violations and related warnings is the SQL_LIST structure. For example, consider its member function `link_in_list` which takes a pointer to pointer of type T (any type) as a pointer to pointer to unsigned char. Dereferencing this pointer, which is done to reset the next field, violates strict-aliasing rules and might cause problems for surrounding code that uses the next field of the object being added to the list. The solution is to use templates to parametrize the SQL_LIST structure in order to deference the pointers with compatible types. As a side bonus, it becomes possible to remove quite a few casts related to acessing data members of SQL_LIST.
This commit is contained in:
@@ -653,7 +653,7 @@ bool Table_triggers_list::create_trigger(THD *thd, TABLE_LIST *tables,
|
||||
*/
|
||||
old_field= new_field= table->field;
|
||||
|
||||
for (trg_field= (Item_trigger_field *)(lex->trg_table_fields.first);
|
||||
for (trg_field= lex->trg_table_fields.first;
|
||||
trg_field; trg_field= trg_field->next_trg_field)
|
||||
{
|
||||
/*
|
||||
@@ -1413,7 +1413,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
||||
*/
|
||||
triggers->trigger_fields[lex.trg_chistics.event]
|
||||
[lex.trg_chistics.action_time]=
|
||||
(Item_trigger_field *)(lex.trg_table_fields.first);
|
||||
lex.trg_table_fields.first;
|
||||
/*
|
||||
Also let us bind these objects to Field objects in table being
|
||||
opened.
|
||||
@@ -1423,8 +1423,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
|
||||
SELECT)...
|
||||
Anyway some things can be checked only during trigger execution.
|
||||
*/
|
||||
for (Item_trigger_field *trg_field=
|
||||
(Item_trigger_field *)(lex.trg_table_fields.first);
|
||||
for (Item_trigger_field *trg_field= lex.trg_table_fields.first;
|
||||
trg_field;
|
||||
trg_field= trg_field->next_trg_field)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user