Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4895

Valgrind warnings (Conditional jump or move depends on uninitialised value) in Field_datetime::get_date on GREATEST(..) IS NULL

    Details

      Description

      CREATE TABLE t1 (dt DATETIME NOT NULL) ENGINE=InnoDB;
      # INSERT is unimportant, it just shows that the table doesn't have to be empty
      INSERT INTO t1 VALUES (NOW()),(NOW());
      SELECT * FROM t1 WHERE GREATEST( dt, '2012-12-21 12:12:12' ) IS NULL;

      ==22755== Thread 5:
      ==22755== Conditional jump or move depends on uninitialised value(s)
      ==22755==    at 0x6444B9: Field_datetime::get_date(st_mysql_time*, unsigned int) (field.cc:5928)
      ==22755==    by 0x58234F: Item_field::get_date(st_mysql_time*, unsigned int) (item.cc:2347)
      ==22755==    by 0x5CBB96: get_datetime_value(THD*, Item***, Item**, Item*, bool*) (item_cmpfunc.cc:891)
      ==22755==    by 0x5B7BC9: Item_func_min_max::get_date(st_mysql_time*, unsigned int) (item_func.cc:2459)
      ==22755==    by 0x5B82B1: Item_func_min_max::val_int() (item_func.cc:2577)
      ==22755==    by 0x59873E: Item::update_null_value() (item.h:955)
      ==22755==    by 0x5C4B98: Item_func::is_null() (item_func.h:163)
      ==22755==    by 0x5D8076: Item_func_isnull::val_int() (item_cmpfunc.cc:4624)
      ==22755==    by 0x5AF299: eval_const_cond(Item*) (item_func.cc:63)
      ==22755==    by 0x72D886: remove_eq_conds(THD*, Item*, Item::cond_result*) (sql_select.cc:13362)
      ==22755==    by 0x72CCAC: optimize_cond(JOIN*, Item*, List<TABLE_LIST>*, bool, Item::cond_result*, COND_EQUAL**) (sql_select.cc:13129)
      ==22755==    by 0x70D411: JOIN::optimize() (sql_select.cc:1019)
      ==22755==    by 0x7147A6: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2976)
      ==22755==    by 0x70B1E6: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:288)
      ==22755==    by 0x696682: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5172)
      ==22755==    by 0x68D441: mysql_execute_command(THD*) (sql_parse.cc:2305)
      ==22755== Conditional jump or move depends on uninitialised value(s)
      ==22755==    at 0x6444D4: Field_datetime::get_date(st_mysql_time*, unsigned int) (field.cc:5930)
      ==22755==    by 0x58234F: Item_field::get_date(st_mysql_time*, unsigned int) (item.cc:2347)
      ==22755==    by 0x5CBB96: get_datetime_value(THD*, Item***, Item**, Item*, bool*) (item_cmpfunc.cc:891)
      ==22755==    by 0x5B7BC9: Item_func_min_max::get_date(st_mysql_time*, unsigned int) (item_func.cc:2459)
      ==22755==    by 0x5B82B1: Item_func_min_max::val_int() (item_func.cc:2577)
      ==22755==    by 0x59873E: Item::update_null_value() (item.h:955)
      ==22755==    by 0x5C4B98: Item_func::is_null() (item_func.h:163)
      ==22755==    by 0x5D8076: Item_func_isnull::val_int() (item_cmpfunc.cc:4624)
      ==22755==    by 0x5AF299: eval_const_cond(Item*) (item_func.cc:63)
      ==22755==    by 0x72D886: remove_eq_conds(THD*, Item*, Item::cond_result*) (sql_select.cc:13362)
      ==22755==    by 0x72CCAC: optimize_cond(JOIN*, Item*, List<TABLE_LIST>*, bool, Item::cond_result*, COND_EQUAL**) (sql_select.cc:13129)
      ==22755==    by 0x70D411: JOIN::optimize() (sql_select.cc:1019)
      ==22755==    by 0x7147A6: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2976)
      ==22755==    by 0x70B1E6: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:288)
      ==22755==    by 0x696682: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5172)
      ==22755==    by 0x68D441: mysql_execute_command(THD*) (sql_parse.cc:2305)
      ==22755== Conditional jump or move depends on uninitialised value(s)
      ==22755==    at 0x6444DF: Field_datetime::get_date(st_mysql_time*, unsigned int) (field.cc:5930)
      ==22755==    by 0x58234F: Item_field::get_date(st_mysql_time*, unsigned int) (item.cc:2347)
      ==22755==    by 0x5CBB96: get_datetime_value(THD*, Item***, Item**, Item*, bool*) (item_cmpfunc.cc:891)
      ==22755==    by 0x5B7BC9: Item_func_min_max::get_date(st_mysql_time*, unsigned int) (item_func.cc:2459)
      ==22755==    by 0x5B82B1: Item_func_min_max::val_int() (item_func.cc:2577)
      ==22755==    by 0x59873E: Item::update_null_value() (item.h:955)
      ==22755==    by 0x5C4B98: Item_func::is_null() (item_func.h:163)
      ==22755==    by 0x5D8076: Item_func_isnull::val_int() (item_cmpfunc.cc:4624)
      ==22755==    by 0x5AF299: eval_const_cond(Item*) (item_func.cc:63)
      ==22755==    by 0x72D886: remove_eq_conds(THD*, Item*, Item::cond_result*) (sql_select.cc:13362)
      ==22755==    by 0x72CCAC: optimize_cond(JOIN*, Item*, List<TABLE_LIST>*, bool, Item::cond_result*, COND_EQUAL**) (sql_select.cc:13129)
      ==22755==    by 0x70D411: JOIN::optimize() (sql_select.cc:1019)
      ==22755==    by 0x7147A6: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2976)
      ==22755==    by 0x70B1E6: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:288)
      ==22755==    by 0x696682: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5172)
      ==22755==    by 0x68D441: mysql_execute_command(THD*) (sql_parse.cc:2305)
      ==22755== Conditional jump or move depends on uninitialised value(s)
      ==22755==    at 0x5B7C35: Item_func_min_max::get_date(st_mysql_time*, unsigned int) (item_func.cc:2468)
      ==22755==    by 0x5B82B1: Item_func_min_max::val_int() (item_func.cc:2577)
      ==22755==    by 0x59873E: Item::update_null_value() (item.h:955)
      ==22755==    by 0x5C4B98: Item_func::is_null() (item_func.h:163)
      ==22755==    by 0x5D8076: Item_func_isnull::val_int() (item_cmpfunc.cc:4624)
      ==22755==    by 0x5AF299: eval_const_cond(Item*) (item_func.cc:63)
      ==22755==    by 0x72D886: remove_eq_conds(THD*, Item*, Item::cond_result*) (sql_select.cc:13362)
      ==22755==    by 0x72CCAC: optimize_cond(JOIN*, Item*, List<TABLE_LIST>*, bool, Item::cond_result*, COND_EQUAL**) (sql_select.cc:13129)
      ==22755==    by 0x70D411: JOIN::optimize() (sql_select.cc:1019)
      ==22755==    by 0x7147A6: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2976)
      ==22755==    by 0x70B1E6: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:288)
      ==22755==    by 0x696682: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5172)
      ==22755==    by 0x68D441: mysql_execute_command(THD*) (sql_parse.cc:2305)
      ==22755==    by 0x6990FC: mysql_parse(THD*, char*, unsigned int, char const**) (sql_parse.cc:6173)
      ==22755==    by 0x68ABE5: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1243)
      ==22755==    by 0x689E83: do_command(THD*) (sql_parse.cc:923)
      ==22755== Conditional jump or move depends on uninitialised value(s)
      ==22755==    at 0x918686: unpack_time (my_time.c:1461)
      ==22755==    by 0x5B7C8D: Item_func_min_max::get_date(st_mysql_time*, unsigned int) (item_func.cc:2471)
      ==22755==    by 0x5B82B1: Item_func_min_max::val_int() (item_func.cc:2577)
      ==22755==    by 0x59873E: Item::update_null_value() (item.h:955)
      ==22755==    by 0x5C4B98: Item_func::is_null() (item_func.h:163)
      ==22755==    by 0x5D8076: Item_func_isnull::val_int() (item_cmpfunc.cc:4624)
      ==22755==    by 0x5AF299: eval_const_cond(Item*) (item_func.cc:63)
      ==22755==    by 0x72D886: remove_eq_conds(THD*, Item*, Item::cond_result*) (sql_select.cc:13362)
      ==22755==    by 0x72CCAC: optimize_cond(JOIN*, Item*, List<TABLE_LIST>*, bool, Item::cond_result*, COND_EQUAL**) (sql_select.cc:13129)
      ==22755==    by 0x70D411: JOIN::optimize() (sql_select.cc:1019)
      ==22755==    by 0x7147A6: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2976)
      ==22755==    by 0x70B1E6: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:288)
      ==22755==    by 0x696682: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5172)
      ==22755==    by 0x68D441: mysql_execute_command(THD*) (sql_parse.cc:2305)
      ==22755==    by 0x6990FC: mysql_parse(THD*, char*, unsigned int, char const**) (sql_parse.cc:6173)
      ==22755==    by 0x68ABE5: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1243)
      ==22755== Conditional jump or move depends on uninitialised value(s)
      ==22755==    at 0x7D61D3: non_zero_date(st_mysql_time const*) (mysql_priv.h:2564)
      ==22755==    by 0x7D6218: check_date(st_mysql_time const*, unsigned long long, int*) (mysql_priv.h:2569)
      ==22755==    by 0x7D68D6: check_date_with_warn(st_mysql_time const*, unsigned int, enum_mysql_timestamp_type) (time.cc:221)
      ==22755==    by 0x5B7CAD: Item_func_min_max::get_date(st_mysql_time*, unsigned int) (item_func.cc:2475)
      ==22755==    by 0x5B82B1: Item_func_min_max::val_int() (item_func.cc:2577)
      ==22755==    by 0x59873E: Item::update_null_value() (item.h:955)
      ==22755==    by 0x5C4B98: Item_func::is_null() (item_func.h:163)
      ==22755==    by 0x5D8076: Item_func_isnull::val_int() (item_cmpfunc.cc:4624)
      ==22755==    by 0x5AF299: eval_const_cond(Item*) (item_func.cc:63)
      ==22755==    by 0x72D886: remove_eq_conds(THD*, Item*, Item::cond_result*) (sql_select.cc:13362)
      ==22755==    by 0x72CCAC: optimize_cond(JOIN*, Item*, List<TABLE_LIST>*, bool, Item::cond_result*, COND_EQUAL**) (sql_select.cc:13129)
      ==22755==    by 0x70D411: JOIN::optimize() (sql_select.cc:1019)
      ==22755==    by 0x7147A6: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2976)
      ==22755==    by 0x70B1E6: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:288)
      ==22755==    by 0x696682: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5172)
      ==22755==    by 0x68D441: mysql_execute_command(THD*) (sql_parse.cc:2305)
      ==22755== Conditional jump or move depends on uninitialised value(s)
      ==22755==    at 0x915853: check_date (my_time.c:87)
      ==22755==    by 0x7D622F: check_date(st_mysql_time const*, unsigned long long, int*) (mysql_priv.h:2569)
      ==22755==    by 0x7D68D6: check_date_with_warn(st_mysql_time const*, unsigned int, enum_mysql_timestamp_type) (time.cc:221)
      ==22755==    by 0x5B7CAD: Item_func_min_max::get_date(st_mysql_time*, unsigned int) (item_func.cc:2475)
      ==22755==    by 0x5B82B1: Item_func_min_max::val_int() (item_func.cc:2577)
      ==22755==    by 0x59873E: Item::update_null_value() (item.h:955)
      ==22755==    by 0x5C4B98: Item_func::is_null() (item_func.h:163)
      ==22755==    by 0x5D8076: Item_func_isnull::val_int() (item_cmpfunc.cc:4624)
      ==22755==    by 0x5AF299: eval_const_cond(Item*) (item_func.cc:63)
      ==22755==    by 0x72D886: remove_eq_conds(THD*, Item*, Item::cond_result*) (sql_select.cc:13362)
      ==22755==    by 0x72CCAC: optimize_cond(JOIN*, Item*, List<TABLE_LIST>*, bool, Item::cond_result*, COND_EQUAL**) (sql_select.cc:13129)
      ==22755==    by 0x70D411: JOIN::optimize() (sql_select.cc:1019)
      ==22755==    by 0x7147A6: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2976)
      ==22755==    by 0x70B1E6: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:288)
      ==22755==    by 0x696682: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5172)
      ==22755==    by 0x68D441: mysql_execute_command(THD*) (sql_parse.cc:2305)
      ==22755== Conditional jump or move depends on uninitialised value(s)
      ==22755==    at 0x91586C: check_date (my_time.c:88)
      ==22755==    by 0x7D622F: check_date(st_mysql_time const*, unsigned long long, int*) (mysql_priv.h:2569)
      ==22755==    by 0x7D68D6: check_date_with_warn(st_mysql_time const*, unsigned int, enum_mysql_timestamp_type) (time.cc:221)
      ==22755==    by 0x5B7CAD: Item_func_min_max::get_date(st_mysql_time*, unsigned int) (item_func.cc:2475)
      ==22755==    by 0x5B82B1: Item_func_min_max::val_int() (item_func.cc:2577)
      ==22755==    by 0x59873E: Item::update_null_value() (item.h:955)
      ==22755==    by 0x5C4B98: Item_func::is_null() (item_func.h:163)
      ==22755==    by 0x5D8076: Item_func_isnull::val_int() (item_cmpfunc.cc:4624)
      ==22755==    by 0x5AF299: eval_const_cond(Item*) (item_func.cc:63)
      ==22755==    by 0x72D886: remove_eq_conds(THD*, Item*, Item::cond_result*) (sql_select.cc:13362)
      ==22755==    by 0x72CCAC: optimize_cond(JOIN*, Item*, List<TABLE_LIST>*, bool, Item::cond_result*, COND_EQUAL**) (sql_select.cc:13129)
      ==22755==    by 0x70D411: JOIN::optimize() (sql_select.cc:1019)
      ==22755==    by 0x7147A6: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2976)
      ==22755==    by 0x70B1E6: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:288)
      ==22755==    by 0x696682: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5172)
      ==22755==    by 0x68D441: mysql_execute_command(THD*) (sql_parse.cc:2305)
      ==22755== Use of uninitialised value of size 8
      ==22755==    at 0x915881: check_date (my_time.c:89)
      ==22755==    by 0x7D622F: check_date(st_mysql_time const*, unsigned long long, int*) (mysql_priv.h:2569)
      ==22755==    by 0x7D68D6: check_date_with_warn(st_mysql_time const*, unsigned int, enum_mysql_timestamp_type) (time.cc:221)
      ==22755==    by 0x5B7CAD: Item_func_min_max::get_date(st_mysql_time*, unsigned int) (item_func.cc:2475)
      ==22755==    by 0x5B82B1: Item_func_min_max::val_int() (item_func.cc:2577)
      ==22755==    by 0x59873E: Item::update_null_value() (item.h:955)
      ==22755==    by 0x5C4B98: Item_func::is_null() (item_func.h:163)
      ==22755==    by 0x5D8076: Item_func_isnull::val_int() (item_cmpfunc.cc:4624)
      ==22755==    by 0x5AF299: eval_const_cond(Item*) (item_func.cc:63)
      ==22755==    by 0x72D886: remove_eq_conds(THD*, Item*, Item::cond_result*) (sql_select.cc:13362)
      ==22755==    by 0x72CCAC: optimize_cond(JOIN*, Item*, List<TABLE_LIST>*, bool, Item::cond_result*, COND_EQUAL**) (sql_select.cc:13129)
      ==22755==    by 0x70D411: JOIN::optimize() (sql_select.cc:1019)
      ==22755==    by 0x7147A6: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2976)
      ==22755==    by 0x70B1E6: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:288)
      ==22755==    by 0x696682: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5172)
      ==22755==    by 0x68D441: mysql_execute_command(THD*) (sql_parse.cc:2305)
      ==22755== Conditional jump or move depends on uninitialised value(s)
      ==22755==    at 0x91588D: check_date (my_time.c:89)
      ==22755==    by 0x7D622F: check_date(st_mysql_time const*, unsigned long long, int*) (mysql_priv.h:2569)
      ==22755==    by 0x7D68D6: check_date_with_warn(st_mysql_time const*, unsigned int, enum_mysql_timestamp_type) (time.cc:221)
      ==22755==    by 0x5B7CAD: Item_func_min_max::get_date(st_mysql_time*, unsigned int) (item_func.cc:2475)
      ==22755==    by 0x5B82B1: Item_func_min_max::val_int() (item_func.cc:2577)
      ==22755==    by 0x59873E: Item::update_null_value() (item.h:955)
      ==22755==    by 0x5C4B98: Item_func::is_null() (item_func.h:163)
      ==22755==    by 0x5D8076: Item_func_isnull::val_int() (item_cmpfunc.cc:4624)
      ==22755==    by 0x5AF299: eval_const_cond(Item*) (item_func.cc:63)
      ==22755==    by 0x72D886: remove_eq_conds(THD*, Item*, Item::cond_result*) (sql_select.cc:13362)
      ==22755==    by 0x72CCAC: optimize_cond(JOIN*, Item*, List<TABLE_LIST>*, bool, Item::cond_result*, COND_EQUAL**) (sql_select.cc:13129)
      ==22755==    by 0x70D411: JOIN::optimize() (sql_select.cc:1019)
      ==22755==    by 0x7147A6: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*) (sql_select.cc:2976)
      ==22755==    by 0x70B1E6: handle_select(THD*, st_lex*, select_result*, unsigned long) (sql_select.cc:288)
      ==22755==    by 0x696682: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5172)
      ==22755==    by 0x68D441: mysql_execute_command(THD*) (sql_parse.cc:2305)

      bzr version-info

      revision-id: bar@mariadb.org-20130812124759-8cy7ot1s3ysgned2
      revno: 3674
      branch-nick: 5.3

      Built with BUILD/compile-pentium-valgrind-max-no-ndb

      Also reproducible on 5.5, 10.0.

        Attachments

          Activity

            People

            • Assignee:
              timour Timour Katchaounov (Inactive)
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: