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

From: Eli Zaretskii <[email-masked]>
Date: Sat, 28 Oct 2017 19:41:33 +0300

> From: Richard Copley <[email-masked]>
> Date: Sat, 28 Oct 2017 17:16:14 +0100
> Cc: [email-masked]
> 
> > 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;
> 
> Looks good. There's no crash and getcjmp is aligned:
> 
> Thread 1 hit Breakpoint 3, quit_throw_to_read_char (
>     from_signal=from_signal@entry=false) at keyboard.c:10548
> 10548     sys_longjmp (getcjmp, 1);
> (gdb) p &getcjmp
> $1 = (sys_jmp_buf *) 0x4005cdaf0 <main_thread+224>

Thanks, I installed that.

If the problem doesn't come back, please close the bug.