unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [BUG][PATCH] emacs23, make bootstrap failed on x86_64 systems
@ 2008-04-04  7:27 Dan Kruchinin
  2008-04-04  8:49 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Kruchinin @ 2008-04-04  7:27 UTC (permalink / raw)
  To: emacs-devel

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.




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-04  9:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-04  7:27 [BUG][PATCH] emacs23, make bootstrap failed on x86_64 systems Dan Kruchinin
2008-04-04  8:49 ` Andreas Schwab
2008-04-04  9:46   ` Dan Kruchinin

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).