Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Tiago Stürmer Daitx" <tdaitx@linux.vnet.ibm.com>
To: gdb-patches@sourceware.org
Subject: [PATCH] Fix printing functions with complex return on PPC64
Date: Sat, 17 Nov 2012 16:01:00 -0000	[thread overview]
Message-ID: <50a7b46b.6jsIRrSz9fiMZdfw%tdaitx@linux.vnet.ibm.com> (raw)

This patch fix the current PPC64 return value code to properly handle complex 
types by passing the target type of the COMPLEX value.

Previously two testcases from gdb.base/callfuncs.exp and another two from
gdb.base/varargs.exp would fail with GDB Interal Error due to improperly
calling convert_typed_floating with a COMPLEX type instead of using the
target type.

Excerpt from a diff between PPC64 run log before and after the fix:

  -FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns float _Complex (GDB internal error)
  -FAIL: gdb.base/callfuncs.exp: call inferior func with struct - returns double _Complex (GDB internal error)

  -FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4) (GDB internal error)
  -FAIL: gdb.base/varargs.exp: print find_max_double_real(4, dc1, dc2, dc3, dc4) (GDB internal error)
  +FAIL: gdb.base/varargs.exp: print find_max_float_real(4, fc1, fc2, fc3, fc4)

The existing FAIL is due to the complex arguments and will be fixed by another 
patch series.

No regression was detected on PPC (32 bits) testcases.

Regards,
Tiago Daitx


gdb/Changelog

2012-11-01  Tiago Stürmer Daitx  <tdaitx@linux.vnet.ibm.com>

        * ppc-sysv-tdep.c (ppc64_sysv_abi_return_value): Set correct
        type on float conversion for complex type.
---
 gdb/ppc-sysv-tdep.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index a221b70..1a0f74d 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -1925,7 +1925,8 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
 		{
 		  convert_typed_floating ((const bfd_byte *) writebuf +
 					  i * (TYPE_LENGTH (valtype) / 2),
-					  valtype, regval, regtype);
+					  TYPE_TARGET_TYPE (valtype), regval,
+					  regtype);
 		  regcache_cooked_write (regcache,
                                          tdep->ppc_fp0_regnum + 1 + i,
 					 regval);
@@ -1938,7 +1939,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct value *function,
 		  convert_typed_floating (regval, regtype,
 					  (bfd_byte *) readbuf +
 					  i * (TYPE_LENGTH (valtype) / 2),
-					  valtype);
+					  TYPE_TARGET_TYPE (valtype));
 		}
 	    }
 	}
-- 
1.7.1


             reply	other threads:[~2012-11-17 16:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-17 16:01 Tiago Stürmer Daitx [this message]
2012-11-26  9:44 ` Jan Kratochvil
2013-01-23 18:37 Tiago Stürmer Daitx
2013-01-23 19:29 ` Ulrich Weigand
2013-01-23 20:04   ` Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50a7b46b.6jsIRrSz9fiMZdfw%tdaitx@linux.vnet.ibm.com \
    --to=tdaitx@linux.vnet.ibm.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox