| delorie.com/archives/browse.cgi | search |
| DMARC-Filter: | OpenDMARC Filter v1.4.2 delorie.com 61Q9rwpT1010857 |
| Authentication-Results: | delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com |
| Authentication-Results: | delorie.com; spf=pass smtp.mailfrom=cygwin.com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 delorie.com 61Q9rwpT1010857 |
| Authentication-Results: | delorie.com; |
| dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=Mu3dxc3g | |
| X-Recipient: | archive-cygwin AT delorie DOT com |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 216F54B9DB4A |
| DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
| s=default; t=1772099637; | |
| bh=VyGxKUOGkrLOGPGieTn2Oo1VMJLvR7Jvp2Q2/rpIWY0=; | |
| h=Date:To:Cc:In-Reply-To:References:Subject:List-Id: | |
| List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: | |
| From:Reply-To:From; | |
| b=Mu3dxc3gM5QFkodYoMRpjAbDIlrzTs1cQDEBv5efR2C09bfZQWMjjuZ58vMcUoLjA | |
| DkYU2SMBVak6zXSZJM2mRAu9RBwQxGlcw1LFqgatCNMacnqGDJAyvlh3Xq5Md94rTw | |
| xGOzqeHPmOCkIlNEbJIU1iwCOyZ20wLu4hT4Qsbk= | |
| X-Original-To: | cygwin AT cygwin DOT com |
| Delivered-To: | cygwin AT cygwin DOT com |
| DMARC-Filter: | OpenDMARC Filter v1.4.2 sourceware.org E08664BA23C8 |
| ARC-Filter: | OpenARC Filter v1.0.0 sourceware.org E08664BA23C8 |
| ARC-Seal: | i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1772099587; cv=none; |
| b=FTNYqyCCLVfZ25Ed6AjjZ6WqLGIYPa5aDSdNDbXFwFKn7N561PneexdfiKqCaZi5QEMPIyq9jvhg8mjmls4LEXXnG7WV2yK16AyoKNZBpNRstP1DbDCDBUCKd4Uba7kYJ78lpTuZf1iRWDGdtUqt0MHvetNXLxqCL+J76TlWpRM= | |
| ARC-Message-Signature: | i=1; a=rsa-sha256; d=sourceware.org; s=key; |
| t=1772099587; c=relaxed/simple; | |
| bh=L2z2qBAxL5W23105yDbYYmKd+e38dsHQs816S5rdvh8=; | |
| h=DKIM-Signature:Date:From:To:Message-ID:Subject:MIME-Version; | |
| b=ElPNOrAi8rO2XYrTPJqQpPICGKeqNtJJAg2tHm6IeJBHgt2r2t9MMYC0E4rFrTVfoK20ojitG0YJ595ZEaeGBkakXkwYu68NnE5InJz+8o+kImo8AoZh5ZRnxNCMJF9usxinV4OXy3Mxbc7TIt/DK5LkX0g2yszalymOhYXP414= | |
| ARC-Authentication-Results: | i=1; server2.sourceware.org |
| DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org E08664BA23C8 |
| Date: | Thu, 26 Feb 2026 01:53:01 -0800 (PST) |
| To: | Glenn Strauss <gs-cygwin DOT com AT gluelogic DOT com> |
| Cc: | KENNON J CONRAD via Cygwin <cygwin AT cygwin DOT com> |
| Message-ID: | <952334155.1508548.1772099582006@connect.xfinity.com> |
| In-Reply-To: | <aaABFf5iEowV1l7I@xps13> |
| References: | <547312365 DOT 1464244 DOT 1771958282029 AT connect DOT xfinity DOT com> |
| <aZ7PrbisVR1R4A7v AT dimstar DOT local DOT net> | |
| <1670201592 DOT 1489273 DOT 1772043520008 AT connect DOT xfinity DOT com> | |
| <e91d8b5b-2690-4271-aa74-e6226440e33d AT SystematicSW DOT ab DOT ca> | |
| <1044918836 DOT 1507810 DOT 1772086967212 AT connect DOT xfinity DOT com> | |
| <1579472684 DOT 1508349 DOT 1772092747339 AT connect DOT xfinity DOT com> | |
| <aaABFf5iEowV1l7I AT xps13> | |
| Subject: | Re: Memmove causing program crashes, giving SIGTRAP in GDB(?) |
| MIME-Version: | 1.0 |
| X-Priority: | 3 |
| Importance: | Normal |
| X-Mailer: | Open-Xchange Mailer v7.10.6-Rev83 |
| X-Originating-IP: | ::ffff:50.47.202.14 |
| X-Originating-Port: | 18016 |
| X-Originating-Client: | open-xchange-appsuite |
| X-CMAE-Envelope: | MS4xfA1q+sowEYUqrbeXldt/3p3B6ikAiO+2pV1lIxAoAcw01ty/wJvOLLCa0Q5YhoLbVUKbfyQKv0mbG1W/cVMhO56WKc3BeDrfR76H3B3SZUDEDiekKgPk |
| jIP7cZ6z6fZmDMDGOYdglHZLIJvpc5DWxyYG86wVK1cjVyM4E3fONAXA8ta7G1zbBr1Ns5HG3jjc6T+wGz5dOaDgyZZ/iyw50TYvFK9EIYd/0N+vbxRhQK7V | |
| MSsmtPztiTXt+MseXQnVWJPIaUsia+NcpVX/Z+5ekC8= | |
| X-BeenThere: | cygwin AT cygwin DOT com |
| X-Mailman-Version: | 2.1.30 |
| List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
| List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
| List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
| List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
| <mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
| From: | KENNON J CONRAD via Cygwin <cygwin AT cygwin DOT com> |
| Reply-To: | KENNON J CONRAD <kennonconrad AT comcast DOT net> |
| Errors-To: | cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com |
| Sender: | "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com> |
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 <gs-cygwin DOT com AT gluelogic DOT com> 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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |