all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>, Andreas Schwab <schwab@suse.de>
Cc: ulm@gentoo.org, 30855@debbugs.gnu.org, gentoo-bug@opensource.sf-tec.de
Subject: bug#30855: 25.3; temacs fails with bus error during garbage collection
Date: Tue, 20 Mar 2018 09:58:12 -0700	[thread overview]
Message-ID: <23993a7d-08e3-2c23-ace1-25850620e59e@cs.ucla.edu> (raw)
In-Reply-To: <83tvtalmy4.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 452 bytes --]

Even with the fix the code assumes that Lisp_Object is aligned at least 
as strictly as void *; this should be verified. Plus, if the alignments 
are the same Emacs can avoid a runtime check each time through the loop, 
which should help branch prediction. I installed the attached into 
master; if it fixes Ulrich's problem I think this should be backported 
to emacs-26. Thanks to Ulrich, Eli, and Andreas for reporting this and 
suggesting the fix.

[-- Attachment #2: 0001-Port-to-32-bit-sparc64.patch --]
[-- Type: text/x-patch, Size: 1058 bytes --]

From 59abd64e9a448bbc5e375a9238d55074d3c9ba11 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 20 Mar 2018 09:54:20 -0700
Subject: [PATCH] Port to 32-bit sparc64

Problem reported by Ulrich Mueller; fix suggested by Eli Zaretskii
and Andreas Schwab (Bug#30855).
* src/alloc.c (mark_memory): Call mark_maybe_object only on
pointers that are properly aligned for Lisp_Object.
---
 src/alloc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/alloc.c b/src/alloc.c
index f97b99c0f3..da01173fba 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -4981,7 +4981,11 @@ mark_memory (void *start, void *end)
   for (pp = start; (void *) pp < end; pp += GC_POINTER_ALIGNMENT)
     {
       mark_maybe_pointer (*(void **) pp);
-      mark_maybe_object (*(Lisp_Object *) pp);
+
+      verify (alignof (Lisp_Object) % GC_POINTER_ALIGNMENT == 0);
+      if (alignof (Lisp_Object) == GC_POINTER_ALIGNMENT
+	  || (uintptr_t) pp % alignof (Lisp_Object) == 0)
+	mark_maybe_object (*(Lisp_Object *) pp);
     }
 }
 
-- 
2.14.3


  reply	other threads:[~2018-03-20 16:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-19 15:23 bug#30855: 25.3; temacs fails with bus error during garbage collection Ulrich Mueller
2018-03-19 19:19 ` Eli Zaretskii
2018-03-20 14:00   ` Ulrich Mueller
2018-03-20 14:47     ` Eli Zaretskii
2018-03-20 15:26       ` Andreas Schwab
2018-03-20 16:40         ` Eli Zaretskii
2018-03-20 16:58           ` Paul Eggert [this message]
2018-03-20 17:15             ` Eli Zaretskii
2018-03-20 21:19               ` Ulrich Mueller
2018-03-20 21:42                 ` Paul Eggert
2018-03-21  6:20                 ` Eli Zaretskii

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=23993a7d-08e3-2c23-ace1-25850620e59e@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=30855@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=gentoo-bug@opensource.sf-tec.de \
    --cc=schwab@suse.de \
    --cc=ulm@gentoo.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.