3379 Guilhem Bichot 2010-11-22 [merge]
merge of 5.5-bugteam
modified:
mysql-test/r/user_var.result
mysql-test/t/user_var.test
sql/field_conv.cc
sql/item_func.cc
sql/sql_select.cc
3378 Marc Alff 2010-11-21 [merge]
Merge mysql-5.5-bugteam --> mysql-trunk-bugfixing
added:
storage/perfschema/unittest/stub_server_misc.h
modified:
sql/mysqld.cc
storage/perfschema/pfs_lock.h
storage/perfschema/unittest/pfs-t.cc
storage/perfschema/unittest/pfs_instr-oom-t.cc
storage/perfschema/unittest/pfs_instr-t.cc
storage/perfschema/unittest/pfs_instr_class-oom-t.cc
storage/perfschema/unittest/pfs_instr_class-t.cc
=== modified file 'mysql-test/r/user_var.result'
--- a/mysql-test/r/user_var.result 2010-08-20 09:10:52 +0000
+++ b/mysql-test/r/user_var.result 2010-11-22 09:13:46 +0000
@@ -445,6 +445,9 @@ IF(
count(*), 1)
1
DROP TABLE t1;
+select @v:=@v:=sum(1) from dual;
+@v:=@v:=sum(1)
+1
End of 5.1 tests
DROP TABLE IF EXISTS t1;
CREATE TABLE t1(f1 INT AUTO_INCREMENT, PRIMARY KEY(f1));
=== modified file 'mysql-test/t/user_var.test'
--- a/mysql-test/t/user_var.test 2010-08-20 09:10:52 +0000
+++ b/mysql-test/t/user_var.test 2010-11-22 09:13:46 +0000
@@ -344,6 +344,13 @@ FROM t1 GROUP BY a LIMIT 1;
DROP TABLE t1;
+#
+# BUG#56138 "valgrind errors about overlapping memory when
+# double-assigning same variable"
+#
+
+select @v:=@v:=sum(1) from dual;
+
--echo End of 5.1 tests
#
=== modified file 'sql/field_conv.cc'
--- a/sql/field_conv.cc 2010-07-23 20:59:42 +0000
+++ b/sql/field_conv.cc 2010-11-22 09:31:28 +0000
@@ -787,11 +787,8 @@ int field_conv(Field *to,Field *from)
((Field_varstring*)from)->length_bytes ==
((Field_varstring*)to)->length_bytes))
{ // Identical fields
-#ifdef HAVE_purify
- /* This may happen if one does 'UPDATE ... SET x=x' */
- if (to->ptr != from->ptr)
-#endif
- memcpy(to->ptr,from->ptr,to->pack_length());
+ // to->ptr==from->ptr may happen if one does 'UPDATE ... SET x=x'
+ memmove(to->ptr, from->ptr, to->pack_length());
return 0;
}
}
=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc 2010-11-11 09:40:06 +0000
+++ b/sql/item_func.cc 2010-11-22 09:31:28 +0000
@@ -4351,7 +4351,7 @@ update_hash(user_var_entry *entry, bool
length--; // Fix length change above
entry->value[length]= 0; // Store end \0
}
- memcpy(entry->value,ptr,length);
+ memmove(entry->value, ptr, length);
if (type == DECIMAL_RESULT)
((my_decimal*)entry->value)->fix_buffer_pointer();
entry->length= length;
=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc 2010-11-18 16:34:56 +0000
+++ b/sql/sql_select.cc 2010-11-22 09:31:28 +0000
@@ -6226,8 +6226,12 @@ update_ref_and_keys(THD *thd, DYNAMIC_AR
continue;
}
-#ifdef HAVE_purify
- /* Valgrind complains about overlapped memcpy when save_pos==use. */
+#if defined(__GNUC__) && !MY_GNUC_PREREQ(4,4)
+ /*
+ Old gcc used a memcpy(), which is undefined if save_pos==use:
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19410
+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39480
+ */
if (save_pos != use)
#endif
*save_pos= *use;
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-trunk-bugfixing branch (guilhem:3378 to 3379) | Guilhem Bichot | 22 Nov |