From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 543 invoked by alias); 28 Nov 2006 17:10:24 -0000 Received: (qmail 11037 invoked by uid 22791); 28 Nov 2006 17:00:58 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 28 Nov 2006 17:00:49 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id kASH0l3S021571 for ; Tue, 28 Nov 2006 12:00:47 -0500 Received: from pobox.surrey.redhat.com (pobox.surrey.redhat.com [172.16.10.17]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id kASH0jaC031577; Tue, 28 Nov 2006 12:00:46 -0500 Received: from [10.32.68.1] (vpn-68-1.surrey.redhat.com [10.32.68.1]) by pobox.surrey.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id kASH0ilK005828; Tue, 28 Nov 2006 17:00:44 GMT Message-ID: <456C6BC3.3090006@redhat.com> Date: Tue, 28 Nov 2006 17:12:00 -0000 From: Nick Clifton User-Agent: Thunderbird 1.5.0.8 (X11/20061105) MIME-Version: 1.0 To: Nick Clifton , gdb-patches@sourceware.org, kevinb@redhat.com Subject: Re: RFA: Fix compile time warnings building iq2000-tdep.c References: <20061128164758.GC20882@nevyn.them.org> In-Reply-To: <20061128164758.GC20882@nevyn.them.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2006-11/txt/msg00324.txt.bz2 Hi Daniel, > Looks OK except... > >> *************** iq2000_extract_return_value (struct type >> *** 558,564 **** >> returned in a register, and if larger than 8 bytes, it is >> returned in a stack location which is pointed to by the same >> register. */ >> ! CORE_ADDR return_buffer; >> int len = TYPE_LENGTH (type); >> >> if (len <= (2 * 4)) >> --- 558,564 ---- >> returned in a register, and if larger than 8 bytes, it is >> returned in a stack location which is pointed to by the same >> register. */ >> ! gdb_byte return_buffer; >> int len = TYPE_LENGTH (type); >> >> if (len <= (2 * 4)) > > That? Aren't you going to run off the end of that if it's only a > single byte? Urk, yes. How about this version instead: *************** iq2000_extract_return_value (struct type *** 558,564 **** returned in a register, and if larger than 8 bytes, it is returned in a stack location which is pointed to by the same register. */ - CORE_ADDR return_buffer; int len = TYPE_LENGTH (type); if (len <= (2 * 4)) --- 558,563 ---- *************** iq2000_extract_return_value (struct type *** 582,598 **** } else { /* Return values > 8 bytes are returned in memory, pointed to by FN_RETURN_REGNUM. */ ! regcache_cooked_read (regcache, E_FN_RETURN_REGNUM, & return_buffer); ! read_memory (return_buffer, valbuf, TYPE_LENGTH (type)); } } --- 581,605 ---- } else { + CORE_ADDR dummy; + union + { + gdb_byte bytes[sizeof dummy]; + CORE_ADDR addr; + } + return_buffer; + /* Return values > 8 bytes are returned in memory, pointed to by FN_RETURN_REGNUM. */ ! regcache_cooked_read (regcache, E_FN_RETURN_REGNUM, return_buffer.bytes); ! read_memory (return_buffer.addr, valbuf, TYPE_LENGTH (type)); } } (Rest of the patch as before). This makes the puning of gdb_byte and CORE_ADDR explicit, which I think is a good thing, but maybe there is a preferred gdb way of doing this ? (Also I could not think of a clean way of obtaining the size of a CORE_ADDR without using a dummy variable). Cheers Nick