Bug #45779 uninitialized variable used in DBUG printout when merge base table not myisam
Submitted: 26 Jun 2009 8:14 Modified: 27 Jun 2009 11:06
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Merge storage engine Severity:S3 (Non-critical)
Version:5.1.35-debug,5.1.37-debug OS:Windows
Assigned to: CPU Architecture:Any

[26 Jun 2009 8:14] Shane Bester
Description:
On a server built with --with-debug=full there's an uninitialized value being printed in a debug message when a merge base table is not defined as myisam:

Version: '5.1.35-debug-log'  socket: ''  port: 3306  Source distribution
Error:Run-Time Check Failure #3 - The variable 'myisam' is being used without being initialized. At e:\builds\mysql-5.1.35\mysql-5.1.35\storage\myisammrg\ha_myisammrg.cc:383

Variable 'myisam' is not evaluated due to boolean short circuiting:

if ((child->file->ht->db_type != DB_TYPE_MYISAM) ||
   !(myisam= ((ha_myisam*) child->file)->file_ptr()))
{
    DBUG_PRINT("error", ("no MyISAM handle for child table: '%s'.'%s' 0x%lx",
                  child->s->db.str, child->s->table_name.str,
                  (long) child));
    my_errno= HA_ERR_WRONG_MRG_TABLE_DEF;
}
DBUG_PRINT("myrg", ("MyISAM handle: 0x%lx  my_errno: %d",
                (long) myisam, my_errno));

How to repeat:
Run full debug version of mysqld and execute the sql:

flush tables;
drop table if exists m1,t1;
create table t1(id int)engine=memory;
create table m1(id int)engine=merge union=(t1);
check table m1;

Suggested fix:
initialize all those variables to null during declaration.
[27 Jun 2009 11:06] MySQL Verification Team
woops, duplicate of ancient bug #42747 :)