From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18705 invoked by alias); 23 Mar 2007 14:41:39 -0000 Received: (qmail 18697 invoked by uid 22791); 23 Mar 2007 14:41:38 -0000 X-Spam-Check-By: sourceware.org Received: from dmz.mips-uk.com (HELO dmz.mips-uk.com) (194.74.144.194) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 23 Mar 2007 14:41:27 +0000 Received: from internal-mx1 ([192.168.192.240] helo=ukservices1.mips.com) by dmz.mips-uk.com with esmtp (Exim 3.35 #1 (Debian)) id 1HUkxJ-0001LZ-00; Fri, 23 Mar 2007 14:41:25 +0000 Received: from perivale.mips.com ([192.168.192.200]) by ukservices1.mips.com with esmtp (Exim 3.36 #1 (Debian)) id 1HUkxA-0002AG-00; Fri, 23 Mar 2007 14:41:16 +0000 Received: from macro (helo=localhost) by perivale.mips.com with local-esmtp (Exim 4.63) (envelope-from ) id 1HUkxA-0004R1-BM; Fri, 23 Mar 2007 14:41:16 +0000 Date: Fri, 23 Mar 2007 14:41:00 -0000 From: "Maciej W. Rozycki" To: gdb-patches@sourceware.org cc: Nigel Stephens , "Maciej W. Rozycki" Subject: mips-tdep.c: FP varargs fixes Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MIPS-Technologies-UK-MailScanner: Found to be clean X-MIPS-Technologies-UK-MailScanner-From: macro@mips.com 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: 2007-03/txt/msg00206.txt.bz2 Hello, The following changes fix the following test case failure: print find_max_double(5,1.0,17.0,2.0,3.0,4.0) find_max(5, -0.000000, 0.000000, 0.000000, 0.000000, 0.000000) returns 0.000000 $5 = 5.3101701311997171e-315 (gdb) FAIL: gdb.base/varargs.exp: print find_max_double(5,1.0,17.0,2.0,3.0,4.0) This change has been tested natively for mips-unknown-linux-gnu and remotely for mipsisa32-sde-elf, using mips-sim-sde32/-EB and mips-sim-sde32/-EL as the targets, removing the failure for all. 2007-03-23 Nigel Stephens Maciej W. Rozycki * mips-tdep.c (mips_o32_push_dummy_call): Take account of argument alignment requirements when calculating stack space required. When aligning an arg register to eight bytes boundary, align stack_offset too. Write floating-point arguments to the appropriate integer register, if we're not passing in a floating point register. OK to apply? Maciej 12100-0.diff Index: binutils-quilt/src/gdb/mips-tdep.c =================================================================== --- binutils-quilt.orig/src/gdb/mips-tdep.c 2007-03-23 14:21:18.000000000 +0000 +++ binutils-quilt/src/gdb/mips-tdep.c 2007-03-23 14:25:57.000000000 +0000 @@ -3071,8 +3071,16 @@ /* Now make space on the stack for the args. */ for (argnum = 0; argnum < nargs; argnum++) - len += align_up (TYPE_LENGTH (value_type (args[argnum])), - mips_stack_argsize (gdbarch)); + { + struct type *arg_type = check_typedef (value_type (args[argnum])); + int arglen = TYPE_LENGTH (arg_type); + /* Align to double-word if necessary. */ + if (mips_abi_regsize (gdbarch) < 8 + && mips_type_needs_double_align (arg_type)) + len = align_up (len, mips_stack_argsize (gdbarch) * 2); + /* Allocate space on the stack. */ + len += align_up (arglen, mips_stack_argsize (gdbarch)); + } sp -= align_up (len, 16); if (mips_debug) @@ -3208,7 +3216,10 @@ && mips_type_needs_double_align (arg_type)) { if ((argreg & 1)) - argreg++; + { + argreg++; + stack_offset += mips_abi_regsize (gdbarch); + } } /* Note: Floating-point values that didn't fit into an FP register are only written to memory. */ @@ -3272,7 +3283,7 @@ /* Write this portion of the argument to a general purpose register. */ if (argreg <= MIPS_LAST_ARG_REGNUM - && !fp_register_arg_p (typecode, arg_type)) + /*&& !fp_register_arg_p (typecode, arg_type)*/) { LONGEST regval = extract_signed_integer (val, partial_len); /* Value may need to be sign extended, because