maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #00128
Re: [patch 04/11] Avoid Valgrind complaint about GCC-generated overlapping memcpy()
Hi!
>>>>> "knielsen" == knielsen <knielsen@xxxxxxxxxxxxxxx> writes:
knielsen> (Some versions of GCC implement struct_var = struct_var using
knielsen> memcpy(), which violates specs for memcpy() (not allowed for
knielsen> overlapping source and destination).
knielsen> GCC bug 19410: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19410
knielsen> === modified file 'sql/sql_select.cc'
knielsen> ---
knielsen> sql/sql_select.cc | 13 +++++++++++--
knielsen> 1 file changed, 11 insertions(+), 2 deletions(-)
knielsen> Index: sql/sql_select.cc
knielsen> ===================================================================
knielsen> --- sql/sql_select.cc.orig 2009-04-07 13:40:36.000000000 +0200
knielsen> +++ sql/sql_select.cc 2009-04-07 13:42:10.000000000 +0200
knielsen> @@ -1994,8 +1994,17 @@ JOIN::exec()
knielsen> tmp_fields_list2, tmp_all_fields2,
knielsen> fields_list.elements, tmp_all_fields1))
knielsen> DBUG_VOID_RETURN;
knielsen> - curr_join->tmp_fields_list2= tmp_fields_list2;
knielsen> - curr_join->tmp_all_fields2= tmp_all_fields2;
knielsen> +#ifdef HAVE_purify
knielsen> + /*
knielsen> + Some GCCs use memcpy() for struct assignment, even for x=x.
knielsen> + GCC bug 19410: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19410
knielsen> + */
knielsen> + if (curr_join != this)
knielsen> +#endif
knielsen> + {
knielsen> + curr_join->tmp_fields_list2= tmp_fields_list2;
knielsen> + curr_join->tmp_all_fields2= tmp_all_fields2;
knielsen> + }
knielsen> }
knielsen> curr_fields_list= &curr_join->tmp_fields_list2;
knielsen> curr_all_fields= &curr_join->tmp_all_fields2;
ok to push.
I think this is actually something that should be fixed in valgrind;
Copying over itself shouldn't give a warning.
(Or at least, one should be able to disable it)
Regards,
Monty
References