From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27628 invoked by alias); 19 Dec 2007 16:16:03 -0000 Received: (qmail 27618 invoked by uid 22791); 19 Dec 2007 16:16:02 -0000 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 19 Dec 2007 16:15:56 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id C157498150; Wed, 19 Dec 2007 16:15:53 +0000 (GMT) Received: from caradoc.them.org (22.svnf5.xdsl.nauticom.net [209.195.183.55]) by nan.false.org (Postfix) with ESMTP id 77CEE9814F; Wed, 19 Dec 2007 16:15:53 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.68) (envelope-from ) id 1J51aK-0000Mq-23; Wed, 19 Dec 2007 11:15:52 -0500 Date: Wed, 19 Dec 2007 17:08:00 -0000 From: Daniel Jacobowitz To: "Maciej W. Rozycki" Cc: gdb-patches@sourceware.org, David Ung , "Maciej W. Rozycki" Subject: Re: mips-tdep.c: Sign-extend pointers for n32 Message-ID: <20071219161552.GA1280@caradoc.them.org> Mail-Followup-To: "Maciej W. Rozycki" , gdb-patches@sourceware.org, David Ung , "Maciej W. Rozycki" References: <20071216184625.GA22905@caradoc.them.org> <20071219152826.GA30488@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-12-11) 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: 2007-12/txt/msg00321.txt.bz2 On Wed, Dec 19, 2007 at 04:07:13PM +0000, Maciej W. Rozycki wrote: > But in practice it should not matter -- however you represent 8-bit and > 16-bit quantities you cannot overflow into the 64-bit data space as with a > flip of the bit #31 the upper 32 bits follow and when a result is written > back to memory or is otherwise finally processed (like output in a textual > form) it has to be masked to its data width again (obviously "sb/sh" do > this implicitly). So I believe the change is correct as it is and the > question is academic. Let me know if you think otherwise. I happen to know otherwise. I once wasted several days tracking down a bug in the Linux kernel's IP checksumming implementation which resulted in incorrectly extended values in registers; there are MIPS parts which really do behave unpredictably when you use 32-bit arithmetic operations on them (specifically the Broadcom SB1). And I believe a compiler would be justified in using such instructions on a signed char argument. -- Daniel Jacobowitz CodeSourcery