aboutsummaryrefslogtreecommitdiff
blob: b76cf9945d5fc1640c24dc2a7c4bbeadf9d37565 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
Fix segmentation fault on sparc64 with 32 bit userland.
https://bugs.gentoo.org/647238

Backported from upstream git:

commit db64a866f6971c5d63565253c0c8d8db15d4a4dc
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Tue Mar 20 09:54:20 2018 -0700

    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.

--- emacs-25.3-orig/src/alloc.c
+++ emacs-25.3/src/alloc.c
@@ -4892,7 +4892,11 @@
   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);
     }
 }