This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH obv/c++ 2/4] sparc64-tdep.c: Don't assign using memcpy return


This:

  valbuf = memcpy (buf, valbuf, len);

causes a build failure in C++, because memcpy returns the value of
"buf" as a void *.  Instead of adding a cast, we can just do the
assignment separately.

gdb/ChangeLog:

	* sparc64-tdep.c (sparc64_store_arguments): Split assignment of
	valbuf.
---
 gdb/ChangeLog      | 5 +++++
 gdb/sparc64-tdep.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 0a8a693..e86cbad 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
 2015-10-24  Simon Marchi  <simon.marchi@polymtl.ca>
 
+	* sparc64-tdep.c (sparc64_store_arguments): Split assignment of
+	valbuf.
+
+2015-10-24  Simon Marchi  <simon.marchi@polymtl.ca>
+
 	* ia64-tdep.c (ia64_pseudo_register_write): Remove cast.
 	(ia64_push_dummy_call): Remove cast and change type of "to" to
 	array of gdb_byte.
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 4c05277..a23740e 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -890,7 +890,8 @@ sparc64_store_arguments (struct regcache *regcache, int nargs,
 	  /* Structure, Union or long double Complex arguments.  */
 	  gdb_assert (len <= 16);
 	  memset (buf, 0, sizeof (buf));
-	  valbuf = memcpy (buf, valbuf, len);
+	  memcpy (buf, valbuf, len);
+	  valbuf = buf;
 
 	  if (element % 2 && sparc64_16_byte_align_p (type))
 	    element++;
-- 
2.6.2


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]