testcase: ------------- drop table if exists `t1`; create table `t1` (`a` int,key(`a`)) engine=innodb; select 1 from `t1` `t2`,`t1` where `t1`.`a`=`t2`.`a`; build: ------------ sbester@box2:~/big/build/bzr/mysql-trunk> bzr revision-info 3189 alik@sun.com-20100818071819-2lu46b0mm3cs34rf ./BUILD/compile-pentium-debug-max-no-ndb ./scripts/make_binary_distribution then run in homedir using: ---------------------------- tar zxvf mysql-5.6.1-m4-linux-x86_64.tar.gz cd mysql-5.6.1-m4-linux-x86_64 ./scripts/mysql_install_db sbester@box2:~/big/mysql/5.6/mysql-5.6.1-m4-linux-x86_64> valgrind --tool=memcheck --num-callers=50 --leak-check=full --db-attach=no -v --show-reachable=yes ./bin/mysqld --no-defaults --server-id=2 --skip-gr --skip-name-resolve --console --log-warnings=2 --skip-name --datadir=./data --basedir=. ==32488== Memcheck, a memory error detector ==32488== Copyright (C) 2002-2009, and GNU GPL'd, by Julian Seward et al. ==32488== Using Valgrind-3.5.0 and LibVEX; rerun with -h for copyright info ==32488== Command: ./bin/mysqld --no-defaults --server-id=2 --skip-gr --skip-name-resolve --console --log-warnings=2 --skip-name --datadir=./data --basedir=. ==32488== --32488-- Valgrind options: --32488-- --tool=memcheck --32488-- --num-callers=50 --32488-- --leak-check=full --32488-- --db-attach=no --32488-- -v --32488-- --show-reachable=yes --32488-- Contents of /proc/version: --32488-- Linux version 2.6.18.2-34-default (geeko@buildhost) (gcc version 4.1.2 20061115 (prerelease) (SUSE Linux)) #1 SMP Mon Nov 27 11:46:27 UTC 2006 --32488-- Arch and hwcaps: AMD64, amd64-sse3 --32488-- Page sizes: currently 4096, max supported 4096 --32488-- Valgrind library directory: /usr/local/lib/valgrind --32488-- Reading syms from /home/sbester/big/mysql/5.6/mysql-5.6.1-m4-linux-x86_64/bin/mysqld (0x400000) --32488-- Reading syms from /lib64/ld-2.5.so (0x4000000) --32488-- Reading syms from /usr/local/lib/valgrind/memcheck-amd64-linux (0x38000000) --32488-- object doesn't have a dynamic symbol table --32488-- Reading suppressions file: /usr/local/lib/valgrind/default.supp --32488-- REDIR: 0x40144d0 (strlen) redirected to 0x3803e657 (vgPlain_amd64_linux_REDIR_FOR_strlen) --32488-- Reading syms from /usr/local/lib/valgrind/vgpreload_core-amd64-linux.so (0x4a1e000) --32488-- Reading syms from /usr/local/lib/valgrind/vgpreload_memcheck-amd64-linux.so (0x4c20000) ==32488== WARNING: new redirection conflicts with existing -- ignoring it --32488-- new: 0x040144d0 (strlen ) R-> 0x04c23f00 strlen --32488-- REDIR: 0x4013fe0 (index) redirected to 0x4c23d70 (index) --32488-- REDIR: 0x4014190 (strcmp) redirected to 0x4c23fd0 (strcmp) --32488-- Reading syms from /lib64/libpthread-2.5.so (0x4e28000) --32488-- Reading syms from /usr/lib64/libaio.so.1.0.1 (0x5043000) --32488-- object doesn't have a symbol table --32488-- Reading syms from /lib64/libz.so.1.2.3 (0x5245000) --32488-- object doesn't have a symbol table --32488-- Reading syms from /lib64/libm-2.5.so (0x545a000) --32488-- Reading syms from /lib64/librt-2.5.so (0x56b0000) --32488-- Reading syms from /lib64/libcrypt-2.5.so (0x58b9000) --32488-- Reading syms from /lib64/libdl-2.5.so (0x5af2000) --32488-- Reading syms from /lib64/libc-2.5.so (0x5cf6000) --32488-- REDIR: 0x5d6b1d0 (memset) redirected to 0x4c24170 (memset) --32488-- REDIR: 0x5d6c7c0 (memcpy) redirected to 0x4c25100 (memcpy) --32488-- REDIR: 0x5d6a3f0 (rindex) redirected to 0x4c23c20 (rindex) --32488-- REDIR: 0x5d69d50 (strlen) redirected to 0x4c23ec0 (strlen) --32488-- REDIR: 0x5d65d70 (calloc) redirected to 0x4c221d2 (calloc) --32488-- REDIR: 0x5d6a0f0 (strnlen) redirected to 0x4c23e90 (strnlen) --32488-- REDIR: 0x5d6b040 (memmove) redirected to 0x4c241c0 (memmove) --32488-- REDIR: 0x5d66300 (malloc) redirected to 0x4c22eda (malloc) --32488-- Reading syms from /lib64/libgcc_s.so.1 (0x6c39000) --32488-- object doesn't have a symbol table --32488-- REDIR: 0x5d6a280 (strncmp) redirected to 0x4c23f20 (strncmp) --32488-- REDIR: 0x5d6bfe0 (stpcpy) redirected to 0x4c24c20 (stpcpy) --32488-- REDIR: 0x5d68fd0 (strcmp) redirected to 0x4c23f90 (strcmp) --32488-- REDIR: 0x5d66790 (realloc) redirected to 0x4c22f8b (realloc) --32488-- REDIR: 0x5d63ec0 (free) redirected to 0x4c22aea (free) --32488-- REDIR: 0x5d69330 (strcpy) redirected to 0x4c25380 (strcpy) --32488-- REDIR: 0xffffffffff600400 (???) redirected to 0x3803e64d (vgPlain_amd64_linux_REDIR_FOR_vtime) --32488-- REDIR: 0x5d68e20 (index) redirected to 0x4c23cb0 (index) --32488-- REDIR: 0x5d6d450 (rawmemchr) redirected to 0x4c24250 (rawmemchr) --32488-- REDIR: 0x5d6a1e0 (strncat) redirected to 0x4c23da0 (strncat) --32488-- REDIR: 0x5d6b430 (mempcpy) redirected to 0x4c249a0 (mempcpy) 100930 11:32:13 [Note] Plugin 'FEDERATED' is disabled. InnoDB: The InnoDB memory heap is disabled InnoDB: Mutexes and rw_locks use GCC atomic builtins InnoDB: Compressed tables use zlib 1.2.3 100930 11:32:13 InnoDB: Using Linux native AIO --32488-- memcheck GC: 1024 nodes, 1024 survivors (100.0%) --32488-- memcheck GC: increase table size to 2048 --32488-- memcheck GC: 2048 nodes, 2048 survivors (100.0%) --32488-- memcheck GC: increase table size to 4096 --32488-- memcheck GC: 4096 nodes, 4096 survivors (100.0%) --32488-- memcheck GC: increase table size to 8192 --32488-- memcheck GC: 8192 nodes, 8192 survivors (100.0%) --32488-- memcheck GC: increase table size to 16384 --32488-- memcheck GC: 16384 nodes, 16384 survivors (100.0%) --32488-- memcheck GC: increase table size to 32768 --32488-- REDIR: 0xffffffffff600000 (???) redirected to 0x3803e643 (vgPlain_amd64_linux_REDIR_FOR_vgettimeofday) InnoDB: The first specified data file ./ibdata1 did not exist: InnoDB: a new database to be created! 100930 11:32:16 InnoDB: Setting file ./ibdata1 size to 10 MB InnoDB: Database physically writes the file full: wait... 100930 11:32:16 InnoDB: Log file ./ib_logfile0 did not exist: new to be created InnoDB: Setting log file ./ib_logfile0 size to 5 MB InnoDB: Database physically writes the file full: wait... 100930 11:32:17 InnoDB: Log file ./ib_logfile1 did not exist: new to be created InnoDB: Setting log file ./ib_logfile1 size to 5 MB InnoDB: Database physically writes the file full: wait... ==32488== Conditional jump or move depends on uninitialised value(s) ==32488== at 0x8A79D7: rw_lock_set_writer_id_and_recursion_flag (sync0rw.ic:283) ==32488== by 0x8A87EB: rw_lock_x_lock_low (sync0rw.c:569) ==32488== by 0x8A88C3: rw_lock_x_lock_func (sync0rw.c:628) ==32488== by 0x920986: mtr_x_lock_func (mtr0mtr.ic:271) ==32488== by 0x8F9740: fsp_header_init (fsp0fsp.c:969) ==32488== by 0x8A604B: innobase_start_or_create_for_mysql (srv0start.c:1537) ==32488== by 0x870475: innobase_init(void*) (ha_innodb.cc:2423) ==32488== by 0x6EE247: ha_initialize_handlerton(st_plugin_int*) (handler.cc:464) ==32488== by 0x5B5CE5: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1037) ==32488== by 0x5B723B: plugin_init(int*, char**, int) (sql_plugin.cc:1323) ==32488== by 0x528DB7: init_server_components() (mysqld.cc:4019) ==32488== by 0x52A347: mysqld_main(int, char**) (mysqld.cc:4602) ==32488== by 0x51F6D2: main (main.cc:24) ==32488== ==32488== Conditional jump or move depends on uninitialised value(s) ==32488== at 0x8A79D7: rw_lock_set_writer_id_and_recursion_flag (sync0rw.ic:283) ==32488== by 0x8A87EB: rw_lock_x_lock_low (sync0rw.c:569) ==32488== by 0x8A88C3: rw_lock_x_lock_func (sync0rw.c:628) ==32488== by 0x8A7E6A: pfs_rw_lock_x_lock_func (sync0rw.ic:692) ==32488== by 0x916CF4: log_group_checkpoint (log0log.c:1865) ==32488== by 0x916F51: log_groups_write_checkpoint_info (log0log.c:1980) ==32488== by 0x9170BC: log_checkpoint (log0log.c:2068) ==32488== by 0x914902: log_fsp_current_free_limit_set_and_checkpoint (log0log.c:190) ==32488== by 0x8FA22C: fsp_fill_free_list (fsp0fsp.c:1401) ==32488== by 0x8F9907: fsp_header_init (fsp0fsp.c:1003) ==32488== by 0x8A604B: innobase_start_or_create_for_mysql (srv0start.c:1537) ==32488== by 0x870475: innobase_init(void*) (ha_innodb.cc:2423) ==32488== by 0x6EE247: ha_initialize_handlerton(st_plugin_int*) (handler.cc:464) ==32488== by 0x5B5CE5: plugin_initialize(st_plugin_int*) (sql_plugin.cc:1037) ==32488== by 0x5B723B: plugin_init(int*, char**, int) (sql_plugin.cc:1323) ==32488== by 0x528DB7: init_server_components() (mysqld.cc:4019) ==32488== by 0x52A347: mysqld_main(int, char**) (mysqld.cc:4602) ==32488== by 0x51F6D2: main (main.cc:24) ==32488== InnoDB: Doublewrite buffer not found: creating new InnoDB: Doublewrite buffer created InnoDB: 127 rollback segment(s) active. InnoDB: Creating foreign key constraint system tables InnoDB: Foreign key constraint system tables created 100930 11:32:24 InnoDB 1.2.0 started; log sequence number 0 --32488-- REDIR: 0x5d6a340 (strncpy) redirected to 0x4c25260 (strncpy) 100930 11:32:24 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: a22c933e-cc75-11df-9add-000c29b9a565. --32488-- REDIR: 0x5d6aad0 (memchr) redirected to 0x4c24050 (memchr) --32488-- REDIR: 0x5d6d580 (strchrnul) redirected to 0x4c24220 (strchrnul) --32488-- Reading syms from /lib64/libnss_files-2.5.so (0x196f1000) 100930 11:32:27 [Note] ./bin/mysqld: ready for connections. Version: '5.6.1-m4-debug' socket: '/tmp/mysql.sock' port: 3306 Source distribution ==32488== Thread 17: ==32488== Source and destination overlap in memcpy(0x15e617c0, 0x15e617c0, 72) ==32488== at 0x4C2516B: memcpy (mc_replace_strmem.c:482) ==32488== by 0x5E1833: update_ref_and_keys(THD*, st_dynamic_array*, st_join_table*, unsigned int, Item*, COND_EQUAL*, unsigned long long, st_select_lex*, st_sargable_param**) (sql_select.cc:4027) ==32488== by 0x5E5F89: make_join_statistics(JOIN*, TABLE_LIST*, Item*, st_dynamic_array*) (sql_select.cc:2773) ==32488== by 0x5E9009: JOIN::optimize() (sql_select.cc:1038) ==32488== by 0x5ED37C: mysql_select(THD*, Item***, TABLE_LIST*, unsigned int, List&, 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:2516) ==32488== by 0x5F29C0: handle_select(THD*, LEX*, select_result*, unsigned long) (sql_select.cc:290) ==32488== by 0x5A1A9B: execute_sqlcom_select(THD*, TABLE_LIST*) (sql_parse.cc:4797) ==32488== by 0x5A2C23: mysql_execute_command(THD*) (sql_parse.cc:2298) ==32488== by 0x5A9EDA: mysql_parse(THD*, char*, unsigned int, Parser_state*) (sql_parse.cc:5826) ==32488== by 0x5AB332: dispatch_command(enum_server_command, THD*, char*, unsigned int) (sql_parse.cc:1128) ==32488== by 0x5AC72A: do_command(THD*) (sql_parse.cc:800) ==32488== by 0x66E022: do_handle_one_connection(THD*) (sql_connect.cc:1191) ==32488== by 0x66E0E8: handle_one_connection (sql_connect.cc:1130) ==32488== by 0x4E2E09D: start_thread (in /lib64/libpthread-2.5.so) ==32488== by 0x5DB74CC: clone (in /lib64/libc-2.5.so) ==32488== sql_select.cc:4027: #ifdef HAVE_purify /* Valgrind complains about overlapped memcpy when save_pos==use. */ if (save_pos != use) #endif *save_pos= *use; <-------------- prev=use; I think those #ifdef shouldn't be there. valgrind warning must be taken seriously in any versions!!!! sbester@box2:~> gcc --version gcc (GCC) 4.1.2 20061115 (prerelease) (SUSE Linux) sbester@box2:~> rpm -qa|grep -i libc glibc-i18ndata-2.5-25 glibc-devel-2.5-25 libcddb-1.3.0-11 glibc-2.5-25 ulibcap-1.92-519 libcom_err-32bit-1.39-21 nlibcroco-32bit-0.6.1-16 alibcroco-0.6.1-16 me -libcdio-0.77-15 aglibc-32bit-2.5-25 glibc-locale-32bit-2.5-25 libcom_err-1.39-21 glibc-locale-2.5-25 glibc-info-2.5-25 sbester@box2:~> uname -a Linux box2 2.6.18.2-34-default #1 SMP Mon Nov 27 11:46:27 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux sbester@box2:~>