From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Kruchinin Newsgroups: gmane.emacs.devel Subject: Re: [BUG][PATCH] emacs23, make bootstrap failed on x86_64 systems Date: Fri, 04 Apr 2008 13:46:18 +0400 Message-ID: <47F5F8EA.40101@gmail.com> References: <47F5D853.5070700@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1207302503 9597 80.91.229.12 (4 Apr 2008 09:48:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Apr 2008 09:48:23 +0000 (UTC) Cc: emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 04 11:48:54 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JhiWh-0000Mq-IG for ged-emacs-devel@m.gmane.org; Fri, 04 Apr 2008 11:48:03 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JhiW4-0008Um-Nq for ged-emacs-devel@m.gmane.org; Fri, 04 Apr 2008 05:47:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JhiVy-0008Rw-Ez for emacs-devel@gnu.org; Fri, 04 Apr 2008 05:47:18 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JhiVw-0008NB-Do for emacs-devel@gnu.org; Fri, 04 Apr 2008 05:47:17 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JhiVw-0008Mx-8o for emacs-devel@gnu.org; Fri, 04 Apr 2008 05:47:16 -0400 Original-Received: from fg-out-1718.google.com ([72.14.220.154]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JhiVv-0003J0-Ok for emacs-devel@gnu.org; Fri, 04 Apr 2008 05:47:15 -0400 Original-Received: by fg-out-1718.google.com with SMTP id d23so4546648fga.30 for ; Fri, 04 Apr 2008 02:47:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; bh=8uRev0/wz7fDcYujnoP6nXj8AEGQTbdr6gTS2qWfBVU=; b=Is/jpfC60XJGfVxka2KGrfV3oqECLcViMG7AZ67J5pd67KiMA5gpUCNJOR+Lx7yg2DiIHfp12t0vMxCpTbSnDYDDdfTYH4eqfz7mbj87+QuPiVBrL6KzsdMljPBSsjeLiPKDJ0w2OhmwCFZY1FHG/m4pTyS6y6qb2xDEm9AMGcQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; b=qR5i+qdYk14f2SQMyt1Ut33Vle+8XJAl7VyLW684Xi6sXSYv1lcjDiNlv9RMvj6aIT/HOlz5h8DR9hoYlQwvwFtDyOTo036pb5wurSMTDTl1Yqb7TO1yCfRxf5Dv+K3HPZ9hwFqR6bVa4QYy2xiPmkQl6WfHiC2vDAw1wHT0c7U= Original-Received: by 10.82.175.17 with SMTP id x17mr2457010bue.23.1207302432369; Fri, 04 Apr 2008 02:47:12 -0700 (PDT) Original-Received: from ?192.168.1.103? ( [77.241.34.239]) by mx.google.com with ESMTPS id 12sm6401101fks.12.2008.04.04.02.47.08 (version=SSLv3 cipher=RC4-MD5); Fri, 04 Apr 2008 02:47:11 -0700 (PDT) User-Agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080109) In-Reply-To: X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:94314 Archived-At: Andreas Schwab wrote: > Dan Kruchinin writes: > > >> But it'll never return false on _LP64 systems(on which EMACS_INT is long >> and sizeof(long) == 8), >> because it uses low bitwise operations expecting that sizeof(EMACS_INT) == >> 4: >> >> --- src/editfns.c: lisp_time_argument --- >> *result = (XINT (high) << 16) + (XINT (low) & 0xffff); >> return *result >> 16 == XINT (high); >> > > Where does this assume a 32bit EMACS_INT? > > Andreas. > > I looked more closely at src/editfns.c and how it works with date and time, so 1st: yep, my patch was invalid 2nd: All functions use int data type for holding seconds. Here for example code from current-time function: -- EMACS_TIME t; EMACS_GET_TIME (t); return list3 (make_number ((EMACS_SECS (t) >> 16) & 0xffff), make_number ((EMACS_SECS (t) >> 0) & 0xffff), make_number (EMACS_USECS (t))); -- or from get-internal-run-time: -- int secs, usecs; ... return list3 (make_number ((secs >> 16) & 0xffff), make_number ((secs >> 0) & 0xffff), make_number (usecs)); -- It implies that both HIGH and LOW have size = 2 bytes. It also implies that they are not depend on how big is int: 32 or 64 bits. But in the function lisp_time_argument 'high' can be greater than 2 bytes because XINT(high) returns long(8 bytes on _LP64) and "*result = (XINT (high) << 16) + (XINT (low) & 0xffff)" will not truncate it because 'result' has type time_t which can be > than 4 bytes. (8 bytes on _LP64). Something like this seems to be valid: "*result = ((XINT (high) & 0xffff) << 16) + (XINT (low) & 0xffff);" or like this: "*result &= 0xffffffff;" Anyway if "seconds" have some size restriction, lisp_time_argument should check it correctly. W.B.R. Dan Kruchinin.