Most memcpy/memmove implementations consist of an initial part that copies/moves any number of leading unaligned bytes, if necessary, followed by a main loop that copies/movies the bulk as words (32 or 64 bit depending on the architecture), and finally a part that copies/moves any number of tailing unaligned bytes.
The implementation you showed in assembly does just that. The main loop will use instructions that are supposed to only be used on aligned memory, but since the leader and trailer are handled separately, you should never run into an alignment exception at that point. My guess is that there is some sort of buffer overrun instead. If the overrun stays within a memory page, you won't notice it, but unrelated data will have been clobbered. However, if the overrun goes over a page boundary, you will get a page fault. -Dimitry > On 26 Feb 2026, at 11:06, KENNON J CONRAD via Cygwin <[email protected]> > wrote: > > Yes, movsq requires addess alignment. Memmove however is not supposed to > require alignment as it should work for chars, ints, etc. It should handle > alignment requirements before calling movsq. That is something I want to > verify. > >> On 02/26/2026 1:17 AM PST matthew patton <[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. >> >> >> 767 * 2 / 8 and 2633 * 2 / 8 would seem to violate that rule. > > -- > 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 -- 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

