Re: Memmove causing program crashes, giving SIGTRAP in GDB(?)

KENNON J CONRAD via Cygwin <[email protected]>
Newsgroups gmane.os.cygwin
Message-ID <[email protected]>
Yes, lots.  7 threads were running at the point of the crash  87% load on my i7-4790k.  I did a little research since the last post.  The memmove code where the crash occurs is:

   0x00007ff96ba812a8 <+136>:	std
=> 0x00007ff96ba812a9 <+137>:	rep movsq %ds:(%rsi),%es:(%rdi)
   0x00007ff96ba812ac <+140>:	cld

This sets the direction flag immediately before the rep movsq and clears the direction flag immediately after the rep movsq.  Yet when gdb breaks it shows the direction flag is not set:

eflags         0x246               [ PF ZF IF ]

  Would a forward move on overlapping data cause the SIGTRAP?  Could the code have moved to a different core?  Or could it have been interrupted by some other task that corrupts the flag?  As I mentioned earlier, the rep movsq is only failing once per several million times memmove is called so it seems likely to be something along those lines.

-Kennon


> On 02/26/2026 12:20 PM PST Dimitry Andric <[email protected]> wrote:
> 
>  
> Is there some concurrency going on? Maybe some other part of the program is flipping the direction flag?
> 
> -Dimitry
>

-- 
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.