maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #00110
[patch 04/11] Avoid Valgrind complaint about GCC-generated overlapping memcpy()
(Some versions of GCC implement struct_var = struct_var using
memcpy(), which violates specs for memcpy() (not allowed for
overlapping source and destination).
GCC bug 19410: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19410
=== modified file 'sql/sql_select.cc'
---
sql/sql_select.cc | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
Index: sql/sql_select.cc
===================================================================
--- sql/sql_select.cc.orig 2009-04-07 13:40:36.000000000 +0200
+++ sql/sql_select.cc 2009-04-07 13:42:10.000000000 +0200
@@ -1994,8 +1994,17 @@ JOIN::exec()
tmp_fields_list2, tmp_all_fields2,
fields_list.elements, tmp_all_fields1))
DBUG_VOID_RETURN;
- curr_join->tmp_fields_list2= tmp_fields_list2;
- curr_join->tmp_all_fields2= tmp_all_fields2;
+#ifdef HAVE_purify
+ /*
+ Some GCCs use memcpy() for struct assignment, even for x=x.
+ GCC bug 19410: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19410
+ */
+ if (curr_join != this)
+#endif
+ {
+ curr_join->tmp_fields_list2= tmp_fields_list2;
+ curr_join->tmp_all_fields2= tmp_all_fields2;
+ }
}
curr_fields_list= &curr_join->tmp_fields_list2;
curr_all_fields= &curr_join->tmp_all_fields2;
--
Follow ups
References