emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[BUG][PATCH] emacs23, make bootstrap failed on x86_64 systems


From: Dan Kruchinin
Subject: [BUG][PATCH] emacs23, make bootstrap failed on x86_64 systems
Date: Fri, 04 Apr 2008 11:27:15 +0400
User-agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080109)

Hi all.

There is a problem with making bootstrap on emacs23 from cvs:
Emacs hangups during the byte compilation of *.el files.
The reason of this problem is an infinite loop that occurs while emacs is
trying to compile calendar/cal-china.el.
cal-china.el requires cal-dst.el which contains the following code:

---
(defun calendar-current-time-zone ()
"quite long doc-string(skipped)"
 (unless calendar-current-time-zone-cache
   (setq calendar-current-time-zone-cache (calendar-dst-find-data))))

(calendar-current-time-zone)
---

After emacs sees direct function call in the required file, it tries to evaluate met function. It evaluates most of code quite well except of those that was modified in the revision #1.42. It's a loop that executes until 'current-time-zone' function will not return nil. This can happen only if its arguments(integers) are too big, i.e. if lisp_time_argument function will return 'false'. 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);
---

Here is a quick'n'dirty patch to fix this problem (src/editfns.c, revision #1.458):

---patch---
--- src/editfns.c 2008-04-04 11:15:28.000000000 +0400
+++ src/editfns.c.patched  2008-04-04 10:37:16.000000000 +0400
@@ -1519,6 +1519,7 @@
  else
    {
      Lisp_Object high, low;
+      int half_word = BITS_PER_EMACS_INT >> 1;
      high = Fcar (specified_time);
      CHECK_NUMBER (high);
      low = Fcdr (specified_time);
@@ -1542,8 +1543,8 @@
      else if (usec)
        *usec = 0;
      CHECK_NUMBER (low);
-      *result = (XINT (high) << 16) + (XINT (low) & 0xffff);
-      return *result >> 16 == XINT (high);
+ *result = (XINT (high) << half_word) + (XINT (low) & (INTMASK >> half_word));
+      return *result >> half_word == XINT (high);
    }
}
----------------

W.B.R.
Dan Kruchinin.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]