• unknown's avatar
    Fix bug MDEV-4895 Valgrind warnings (Conditional jump or move depends on... · 5fdb531d
    unknown authored
    Fix bug MDEV-4895 Valgrind warnings (Conditional jump or move depends on uninitialised value) in Field_datetime::get_date on GREATEST(..) IS NULL
    
    Analysis:
    The cause of the valgrind warning was an attempt to evaluate a Field that was not yet read.
    The reason was that on one hand Item_func_isnotnull was marked as constant by
    Item_func_isnotnull::update_used_tables, and this allowed eval_const_cond() to be called.
    On the other hand Item_func_isnotnull::val_int() evaluated its argument as if it was not
    constant.
    
    Solution:
    The fix make sure that Item_func_isnotnull::val_int() doesn't evaluate its argument when
    it is constant and cannot be NULL, because the result is known in this case. 
    5fdb531d
null.test 9.35 KB