GNU bug report logs -
#29040
emacs-26 crash due to misaligned longjmp buffer in 64-bit MSYS2/MinGW-W64 build
Previous Next
Reported by: Richard Copley <rcopley <at> gmail.com>
Date: Sat, 28 Oct 2017 13:42:02 UTC
Severity: normal
Tags: fixed
Done: Richard Copley <rcopley <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #20 received at 29040 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 28 Oct 2017 17:14:14 +0300
> From: Eli Zaretskii <eliz <at> gnu.org>
> Cc: 29040 <at> debbugs.gnu.org
>
> I'm not saying that this is a GCC bug. But maybe you are right, and
> the changes in d7038020 exposed this problem.
Actually, I think it was caused by 015f0bb. Does the patch below fix
the problem? Please actually check the alignment of getcjmp, not just
that the crashes went away.
diff --git a/src/thread.c b/src/thread.c
index 6f12d79..2520771 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -26,7 +26,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "coding.h"
#include "syssignal.h"
-static struct thread_state alignas (GCALIGNMENT) main_thread;
+#define COMMON_MULTIPLE(a, b) \
+ ((a) % (b) == 0 ? (a) : (b) % (a) == 0 ? (b) : (a) * (b))
+#define THREAD_ALIGNMENT COMMON_MULTIPLE (alignof (max_align_t), GCALIGNMENT)
+
+static struct thread_state alignas (THREAD_ALIGNMENT) main_thread;
struct thread_state *current_thread = &main_thread;
This bug report was last modified 7 years and 208 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.