Subject: Re: bug#29040: Emacs 25 hangs on windows arbitrarily during search of a unicode file

From: Eli Zaretskii <[email-masked]>
Date: Sat, 28 Oct 2017 18:58:28 +0300

> Date: Sat, 28 Oct 2017 17:14:14 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> 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;