unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: "Dan Horák" <dan@danny.cz>
Cc: 10780@debbugs.gnu.org, Andreas Schwab <schwab@linux-m68k.org>
Subject: bug#10780: 24.0.93 fails to build with 'Invalid function: "DEAD"'
Date: Mon, 20 Feb 2012 15:14:39 -0800	[thread overview]
Message-ID: <4F42D3DF.7010303@cs.ucla.edu> (raw)
In-Reply-To: <m24nush0hr.fsf@igel.home>

On 02/15/2012 02:09 AM, Andreas Schwab wrote:

> What about local variables in registers?  They are split between two
> registers, but mark_stack does not handle that.

True.  Teerrroooo.  Thanks for diagnosing that.

I pushed the following fix into the trunk.  It's needed
regardless of this particular bug.  Dan, can you please
check whether it indeed fixes the bug for you?  Thanks.


Fix crash due to non-contiguous EMACS_INT (Bug#10780).
* lisp.h (VALBITS): Move definition up, so that USE_LSB_TAG can use it.
(USE_LSB_TAG): Do not define if UINTPTR_MAX >> VALBITS == 0.
It's useless in that case, and it can cause problems on hosts
that allocate halves of EMACS_INT values separately.
Reported by Dan Horák.  Diagnosed by Andreas Schwab in
<http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10780#30>.
* mem-limits.h (EXCEEDS_LISP_PTR): Define to 0 on hosts where
UINTPTR_MAX >> VALBITS == 0.  This is required by the above change;
it avoids undefined behavior on hosts where shifting right by more
than the word width has undefined behavior.
=== modified file 'src/lisp.h'
--- src/lisp.h	2012-01-19 07:21:25 +0000
+++ src/lisp.h	2012-02-20 16:27:49 +0000
@@ -168,6 +168,10 @@
 #define GCTYPEBITS 3
 #endif

+#ifndef VALBITS
+#define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)
+#endif
+
 #ifndef NO_DECL_ALIGN
 # ifndef DECL_ALIGN
 #  if HAVE_ATTRIBUTE_ALIGNED
@@ -191,7 +195,15 @@
      || defined DARWIN_OS || defined __sun)
 /* We also need to be able to specify mult-of-8 alignment on static vars.  */
 # if defined DECL_ALIGN
-#  define USE_LSB_TAG
+/* mark_maybe_object assumes that EMACS_INT values are contiguous,
+   but this is not true on some hosts where EMACS_INT is wider than a pointer,
+   as they may allocate the halves of an EMACS_INT separately.
+   On these hosts USE_LSB_TAG is not needed because the top bits of an
+   EMACS_INT are unused, so define USE_LSB_TAG only on hosts where it
+   might be useful.  */
+#  if UINTPTR_MAX >> VALBITS != 0
+#   define USE_LSB_TAG
+#  endif
 # endif
 #endif

@@ -309,11 +321,6 @@
     Lisp_Fwd_Kboard_Obj,	/* Fwd to a Lisp_Object field of kboards.  */
   };

-/* These values are overridden by the m- file on some machines.  */
-#ifndef VALBITS
-#define VALBITS (BITS_PER_EMACS_INT - GCTYPEBITS)
-#endif
-
 #ifdef USE_LISP_UNION_TYPE

 #ifndef WORDS_BIGENDIAN

=== modified file 'src/mem-limits.h'
--- src/mem-limits.h	2012-01-19 07:21:25 +0000
+++ src/mem-limits.h	2012-02-20 22:53:46 +0000
@@ -34,7 +34,7 @@
 #endif

 extern char *start_of_data (void);
-#if defined USE_LSB_TAG
+#if defined USE_LSB_TAG || UINTPTR_MAX >> VALBITS == 0
 #define EXCEEDS_LISP_PTR(ptr) 0
 #elif defined DATA_SEG_BITS
 #define EXCEEDS_LISP_PTR(ptr) \






  reply	other threads:[~2012-02-20 23:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-06 23:40 bug#10749: 24.0.93; does not compile on Mac OS X 10.4.11/PPC in international/mule-conf Peter Dyballa
2012-02-09  9:39 ` Peter Dyballa
2012-02-09 21:50   ` Peter Dyballa
2012-02-09 23:45     ` Peter Dyballa
2012-02-15  7:24 ` bug#10749: 24.0.93 fails to build with 'Invalid function: "DEAD"' Paul Eggert
2012-02-15  7:39   ` Dan Horák
2012-02-15  8:14     ` Paul Eggert
2012-02-15  9:55       ` bug#10749: bug#10780: " Andreas Schwab
2012-02-15  9:15     ` Paul Eggert
2012-02-15 10:09       ` Andreas Schwab
2012-02-20 23:14         ` Paul Eggert [this message]
2012-02-21  9:32           ` Dan Horák
2012-02-21 23:37             ` bug#10749: " Paul Eggert
2012-02-15 16:38       ` bug#10780: " Dan Horák
     [not found] ` <handler.10749.B.132860743020881.ack@debbugs.gnu.org>
2012-04-16 20:24   ` bug#10749: Acknowledgement (24.0.93; does not compile on Mac OS X 10.4.11/PPC in international/mule-conf) Peter Dyballa
  -- strict thread matches above, loose matches on Subject: below --
2012-02-10 15:51 bug#10780: 24.0.93 fails to build with 'Invalid function: "DEAD"' Dan Horák
2012-02-10 17:36 ` Glenn Morris

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=4F42D3DF.7010303@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=10780@debbugs.gnu.org \
    --cc=dan@danny.cz \
    --cc=schwab@linux-m68k.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 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).