Valgrind warnings "Conditional jump or move depends on uninitialised value" in create_sort_index with small sort_buffer_size

Description

The failure happens in buildbot on main.order_by and main.filesort_debug tests.

The warning started appearing with the following revision:

1 2 3 4 5 6 7 8 9 10 11 12 ------------------------------------------------------------ revno: 3965.1.14 revision-id: sergii@pisem.net-20140201083407-l6hg86u20byph3i7 parent: sergii@pisem.net-20140201083326-wlzdm7dash8h58m8 fixes bug: https://mariadb.atlassian.net/browse/MDEV-5549 committer: Sergei Golubchik <sergii@pisem.net> branch nick: 10.0 timestamp: Sat 2014-02-01 09:34:07 +0100 message: MDEV-5549 Wrong row counter in found_rows() result only let filesort() count rows for SQL_CALC_ROWS if it's using priority queue

Here is an excerpt from main.order_by which causes the failure (maybe it will be easier to debug, the whole test is rather big):

1 2 3 4 5 create table t1(a int, b tinytext); insert into t1 values (1,2),(3,2); set session sort_buffer_size= 1000; --disable_abort_on_error select * from t1 order by b;
1 ERROR HY001: Out of sort memory, consider increasing server sort buffer size
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ==23750== Thread 4: ==23750== Conditional jump or move depends on uninitialised value(s) ==23750== at 0x6D2E5F: create_sort_index(THD*, JOIN*, st_order*, unsigned long long, unsigned long long, bool) (sql_select.cc:20393) ==23750== by 0x6A8579: JOIN::exec_inner() (sql_select.cc:3035) ==23750== by 0x6A5C8F: JOIN::exec() (sql_select.cc:2355) ==23750== by 0x6A900E: 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:3292) ==23750== by 0x69F76A: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:372) ==23750== by 0x6747F0: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:5301) ==23750== by 0x66CB9B: mysql_execute_command(THD*) (sql_parse.cc:2587) ==23750== by 0x676F7A: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:6447) ==23750== by 0x669D48: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1308) ==23750== by 0x6690EA: do_command(THD*) (sql_parse.cc:1005) ==23750== by 0x783394: do_handle_one_connection(THD*) (sql_connect.cc:1379) ==23750== by 0x7830E7: handle_one_connection (sql_connect.cc:1293) ==23750== by 0xAAB6E0: pfs_spawn_thread (pfs.cc:1853) ==23750== by 0x4E35B4F: start_thread (pthread_create.c:304) ==23750== by 0x6320A7C: clone (clone.S:112)

Stack trace from:

1 2 3 revision-id: svoj@mariadb.org-20140213071355-psk0jpsarx2u7myc revno: 4005 branch-nick: 10.0

Environment

None

Status

Assignee

Sergei Golubchik

Reporter

Elena Stepanova

Labels

External issue ID

None

External issue ID

None

Fix versions

Affects versions

10.0.8

Priority

Major