From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ulrich Mueller Newsgroups: gmane.emacs.bugs Subject: bug#11712: 24.1.50; systime.h shouldn't cast time_t values to long Date: Thu, 14 Jun 2012 21:17:09 +0200 Message-ID: <20442.14517.115727.92705@a1i15.kph.uni-mainz.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----cutting-here-may-damage-your-screen-surface----15577804----" X-Trace: dough.gmane.org 1339701498 31728 80.91.229.3 (14 Jun 2012 19:18:18 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 14 Jun 2012 19:18:18 +0000 (UTC) To: 11712@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 14 21:18:16 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SfFYe-00072H-49 for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jun 2012 21:18:16 +0200 Original-Received: from localhost ([::1]:45843 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfFYe-0008Lf-12 for geb-bug-gnu-emacs@m.gmane.org; Thu, 14 Jun 2012 15:18:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfFYZ-0008KJ-3T for bug-gnu-emacs@gnu.org; Thu, 14 Jun 2012 15:18:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfFYW-0006we-6i for bug-gnu-emacs@gnu.org; Thu, 14 Jun 2012 15:18:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33094) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfFYV-0006wN-Uh for bug-gnu-emacs@gnu.org; Thu, 14 Jun 2012 15:18:08 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SfFbK-0003xG-6V for bug-gnu-emacs@gnu.org; Thu, 14 Jun 2012 15:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ulrich Mueller Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 14 Jun 2012 19:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11712 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.133970162415127 (code B ref -1); Thu, 14 Jun 2012 19:21:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Jun 2012 19:20:24 +0000 Original-Received: from localhost ([127.0.0.1]:42640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SfFai-0003vw-4x for submit@debbugs.gnu.org; Thu, 14 Jun 2012 15:20:24 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50397) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SfFag-0003vp-Bx for submit@debbugs.gnu.org; Thu, 14 Jun 2012 15:20:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfFXq-0006rk-5E for submit@debbugs.gnu.org; Thu, 14 Jun 2012 15:17:27 -0400 Original-Received: from lists.gnu.org ([208.118.235.17]:55397) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfFXq-0006rf-1l for submit@debbugs.gnu.org; Thu, 14 Jun 2012 15:17:26 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfFXo-0008Ec-5q for bug-gnu-emacs@gnu.org; Thu, 14 Jun 2012 15:17:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SfFXm-0006r6-92 for bug-gnu-emacs@gnu.org; Thu, 14 Jun 2012 15:17:23 -0400 Original-Received: from a1iwww1.kph.uni-mainz.de ([134.93.134.1]:46872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SfFXm-0006iP-03 for bug-gnu-emacs@gnu.org; Thu, 14 Jun 2012 15:17:22 -0400 Original-Received: from a1i15.kph.uni-mainz.de (a1i15.kph.uni-mainz.de [134.93.134.92]) by a1iwww1.kph.uni-mainz.de (8.14.4/8.13.4) with ESMTP id q5EJH9Un031973 for ; Thu, 14 Jun 2012 21:17:09 +0200 Original-Received: from a1i15.kph.uni-mainz.de (localhost [127.0.0.1]) by a1i15.kph.uni-mainz.de (8.14.5/8.14.2) with ESMTP id q5EJH9Yd021335; Thu, 14 Jun 2012 21:17:09 +0200 Original-Received: (from ulm@localhost) by a1i15.kph.uni-mainz.de (8.14.5/8.14.5/Submit) id q5EJH9b6021333; Thu, 14 Jun 2012 21:17:09 +0200 X-Mailer: VM 8.2.0b under 23.4.2 (x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:60982 Archived-At: ------cutting-here-may-damage-your-screen-surface----15577804---- Content-Type: text/plain; charset=us-ascii Content-Description: message body text Content-Transfer-Encoding: 7bit The EMACS_TIME_CMP macro defined in systime.h casts the seconds values (which are of type time_t) to long. This is problematic on platforms where time_t has 64 bits but long has only 32 bits, for example GNU/Linux x64_64 systems with x32 ABI. Attached patch should fix it. ------cutting-here-may-damage-your-screen-surface----15577804---- Content-Type: text/plain; name="systime-time_t.diff" Content-Disposition: inline; filename="systime-time_t.diff" Content-Transfer-Encoding: quoted-printable X-MIME-Autoconverted: from 8bit to quoted-printable by a1iwww1.kph.uni-mainz.de id q5EJH9Un031973 --- emacs-orig/src/ChangeLog +++ emacs/src/ChangeLog @@ -1,3 +1,7 @@ +2012-06-14 Ulrich M=C3=BCller + + * systime.h (EMACS_TIME_CMP): Don't cast time_t values to long. + 2012-06-14 Paul Eggert =20 * .gdbinit (xgetint): Fix recently-introduced paren typo. --- emacs-orig/src/systime.h +++ emacs/src/systime.h @@ -147,15 +147,12 @@ #endif =20 /* Compare times T1 and T2. Value is 0 if T1 and T2 are the same. - Value is < 0 if T1 is less than T2. Value is > 0 otherwise. (Cast - to long is for those platforms where time_t is an unsigned - type, and where otherwise T1 will always be grater than T2.) */ + Value is < 0 if T1 is less than T2. Value is > 0 otherwise. */ =20 #define EMACS_TIME_CMP(T1, T2) \ - ((long)EMACS_SECS (T1) - (long)EMACS_SECS (T2) \ - + (EMACS_SECS (T1) =3D=3D EMACS_SECS (T2) \ - ? EMACS_USECS (T1) - EMACS_USECS (T2) \ - : 0)) + (EMACS_SECS (T1) =3D=3D EMACS_SECS (T2) \ + ? EMACS_USECS (T1) - EMACS_USECS (T2) \ + : (EMACS_SECS (T1) < EMACS_SECS (T2) ? -1 : 1)) =20 /* Compare times T1 and T2 for equality, inequality etc. */ =20 ------cutting-here-may-damage-your-screen-surface----15577804------