Details
-
Task
-
Status: Closed (View Workflow)
-
Critical
-
Resolution: Fixed
-
None
Description
Reported by marko, happens when building with -Og and in various components, and likely to pop up again from time to time, so I suggest we keep this ticket open and ongoing as more patches get reviewed and pushed for this issue.
For example, instead of
if ( |
!(db_name = get_field(mem_root, table->field[0])) ||
|
!(table_name = get_field(mem_root, table->field[1])) ||
|
!(link_id = get_field(mem_root, table->field[2]))
|
)
|
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
|
fix with
if (!(db_name = get_field(...)) |
DBUG_RETURN(...);
|
if (!(table_name = get_field(...)) |
DBUG_RETURN(...);
|
if (!(link_id = get_field(...)) |
DBUG_RETURN(...);
|
Attachments
Issue Links
- relates to
-
MDEV-35073 -Wmaybe-uninitialized in result of spider_conn_first_link_idx
-
- Closed
-
Thanks for the comments. ptal at the updated patch:
b1fe542c59b upstream/bb-10.4-mdev-33220 MDEV-33220 Fix -wmaybe-uninitialized warnings
> I think that we should make use of an additional goto label oom: in order to avoid duplicated function calls. I see that this particular function is duplicating a lot of such calls already. Last time I checked, even at -O3 such calls are not being optimized away.
Done.
> Also, it may be a matter of taste, but I would put the assignment outside the if condition. It should make no difference to the generated code: the value should be cached in the "function return value" register (rax on AMD64).
Ack. I prefer the assignment in the condition because it is shorter.
> A side finding in the above code snippet is that if we failed to allocate spider, then we would fail to free the memory that was allocated for tmp_sql.
This is prevented by the following lines under the error label:
{
}