>From the second crash backtrace:
new_score_rank = 767
rank = 3360
candidates_index = 0xa00034460
>From the code:
uint16_t * candidates_index = thread_data_ptr->candidates_index;
.
.
.
memmove(&candidates_index[new_score_rank + 1],
&candidates_index[new_score_rank], 2 * (rank - new_score_rank));
In this case the candidates_index (uint16_t array) starts at address
0xa00034460 and elements 767 - 3359 are being moved into elements 768 - 3360
and the memmove call should be memmove(0xa00034a60, 0xa00034a5e, 5186).
For the first case with address 0xa00034470 and elements 2633 - 4379 being
moved right by 2 bytes it should be (0xa00035904, 0xa00035906, 3492).
That is an excellent point about alignment. I was thinking somehow the rep
count went crazy, but an alignment problem seems at least as likely. I would
hope memmove handles that correctly, but it's one of the things I want to look
at tommorrow. To me the weird part is that it doesn't fail consistently, only
like once per about 2 - 10 million calls at seemingly random points in the
process. The test case does over 10 million calls to memset at this location
and doesn't crash about half the time. I don't know what the rarity of the
SIGTRAP means, but it makes me wonder if it could be interrupt related or even
a hardware problem that is exposed by rep movsq. The alternative bloated but
robust code does not use rep movsq here.
Best Regards,
Kennon
> On 02/26/2026 12:15 AM PST Glenn Strauss <[email protected]> wrote:
>
>
> On Wed, Feb 25, 2026 at 11:59:07PM -0800, KENNON J CONRAD via Cygwin wrote:
> > Okay, so now I learned about setting the frame and disassemble and see the
> > memmove code:
> >
> > Dump of assembler code for function memmove:
> [snip]
> > => 0x00007ff96ba812a9 <+137>: rep movsq %ds:(%rsi),%es:(%rdi)
> [snip]
> > End of assembler dump.
>
> movsq requires address alignment of 8 bytes.
> What are the pointer addresses of the arguments to memmove()?
> A SIGTRAP may result if the addresses are not 8-byte aligned.
>
> Cheers, Glenn
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple