From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1418 invoked by alias); 17 Nov 2012 16:01:39 -0000 Received: (qmail 1401 invoked by uid 22791); 17 Nov 2012 16:01:38 -0000 X-SWARE-Spam-Status: No, hits=-6.6 required=5.0 tests=BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e8.ny.us.ibm.com (HELO e8.ny.us.ibm.com) (32.97.182.138) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 17 Nov 2012 16:01:33 +0000 Received: from /spool/local by e8.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 17 Nov 2012 11:01:32 -0500 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e8.ny.us.ibm.com (192.168.1.108) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 17 Nov 2012 11:01:30 -0500 Received: from d01relay02.pok.ibm.com (d01relay02.pok.ibm.com [9.56.227.234]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id A86CF38C8039 for ; Sat, 17 Nov 2012 11:01:29 -0500 (EST) Received: from d01av04.pok.ibm.com (d01av04.pok.ibm.com [9.56.224.64]) by d01relay02.pok.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qAHG1TrV307366 for ; Sat, 17 Nov 2012 11:01:29 -0500 Received: from d01av04.pok.ibm.com (loopback [127.0.0.1]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qAHG1QFE004287 for ; Sat, 17 Nov 2012 11:01:27 -0500 Received: from igoo.rchland.ibm.com (igoo.rch.stglabs.ibm.com [9.5.250.207]) by d01av04.pok.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with SMTP id qAHG1P8p004199 for ; Sat, 17 Nov 2012 11:01:25 -0500 Date: Sat, 17 Nov 2012 16:01:00 -0000 From: Tiago =?iso-8859-1?Q?St=FCrmer?= Daitx To: gdb-patches@sourceware.org Subject: [PATCH] Fix printing functions with complex return on PPC64 Message-ID: <50a7b46b.6jsIRrSz9fiMZdfw%tdaitx@linux.vnet.ibm.com> User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Content-Scanned: Fidelis XPS MAILER x-cbid: 12111716-9360-0000-0000-00000CE9DD44 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-11/txt/msg00483.txt.bz2 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 * 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