all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dan Kruchinin <dan.kruchinin@gmail.com>
To: emacs-devel@gnu.org
Subject: [BUG][PATCH] emacs23, make bootstrap failed on x86_64 systems
Date: Fri, 04 Apr 2008 11:27:15 +0400	[thread overview]
Message-ID: <47F5D853.5070700@gmail.com> (raw)

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	other threads:[~2008-04-04  7:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-04  7:27 Dan Kruchinin [this message]
2008-04-04  8:49 ` [BUG][PATCH] emacs23, make bootstrap failed on x86_64 systems Andreas Schwab
2008-04-04  9:46   ` Dan Kruchinin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47F5D853.5070700@gmail.com \
    --to=dan.kruchinin@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.