From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Ur46Joucl2pWdB0AWB0awg (envelope-from ) for ; Tue, 01 Sep 2026 23:48:27 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=j8Xcwyyh; dkim=pass (2048-bit key; unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=HB7UiXQa; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 7358F1E09B; Tue, 01 Sep 2026 23:48:27 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 158ED1E09B for ; Tue, 01 Sep 2026 23:48:25 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 198104BA23E3 for ; Wed, 2 Sep 2026 03:48:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 198104BA23E3 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=j8Xcwyyh; dkim=pass (2048-bit key, unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=HB7UiXQa Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id 17D304BA2E24 for ; Wed, 2 Sep 2026 03:47:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 17D304BA2E24 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=oss.qualcomm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 17D304BA2E24 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788320879; cv=none; b=Rx4nghd8ebNVAzwp5cIDjrvQbjgYIhnRRwjTlZbMSoRRuNWyKHRDDap5ZJCLplyTYcDhYNTN8fyVkywpENf5EljH0EIvkcrAT6QbFDb9EJZFWODdv+v8mzlVSgUukaRCzEMe6Ck9zjAPRq30L1A6bDCLFqimgPcZrRdmu+aC5QI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788320879; c=relaxed/simple; bh=fCl+ky4p7Sytstn3FW5JKqaky5o1zuTKuCDci3Ie6ZU=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=hrDrzvwdP0NC84dByV/JAxMMCvsVv5L17yC1oZG7B2qtpn6IEDBSqsCGC4gZzT0gBQPzgRCaqjT1E2YSJk0IVgYgVIgpXhBckmU5BbA9+OAG9KQZ/OQO+lDp7BdtdJ7/vC6yW+0d9X3tRixXRJrVSDxgQytgGgNuiNRdRoyAVbw= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=j8Xcwyyh; dkim=pass (2048-bit key, unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=HB7UiXQa DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 17D304BA2E24 Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 681KTKBb2468868 for ; Wed, 2 Sep 2026 03:47:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= Kuo/kMplXQTmim1xgq1AGrQV22Ee2W7pS7GcxAjds0A=; b=j8XcwyyhUw8y3307 8U2RFvcytZCAiFZ4w4yLQLCXM14mTLnBlJTyNW6TmSqZVYTN15GMPkLX350ylX1q 4i5ZapccVhjxYIqS99cbicDxQYtLXKjUeUq7dMkID6azRtECT4AgRz2lqDDf3KFy 4YS2zoKOOJ6d4sQy0N3NrtrLwyCEpv4YMmB2S3dBrI43zH/3fjYpe1jQ7r1TebGu eTmm4/ST+AD07DmZofoShyHjBVNznH7fCN5Ai1kzeZRi95gZMRu9FdRr9tTjEMG+ iA6X2sUtyPVRaFDtHy6WHS7/5AgFaH8/a5W4TDSM0AMgQolK9uTgohMDU0gEGyok +Hr8jA== Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ge39chx0c-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 02 Sep 2026 03:47:57 +0000 (GMT) Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-38e54b6556aso885918a91.2 for ; Tue, 01 Sep 2026 20:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1788320877; x=1788925677; darn=sourceware.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Kuo/kMplXQTmim1xgq1AGrQV22Ee2W7pS7GcxAjds0A=; b=HB7UiXQaKp6tXMrBfDfqvMx+44wLnjG8jo+rzQiXwzWOANAF8AWxyV8/GOpDYO3Q32 U1LnSCsnkV9nHOww8OKgyC+uz5/l36xgvTgqFnLGudk/ikL//GDT7/pNQgIR72JS3glX z6odRUQKQSKASvbnCVcHjmO6hZpCzvK4RKvzJkkpoTDjSczVoLh2Japd51VlThw1Zz/O 92Lec8rai4KixaBEOHfAfaXbl6wdrLOpjlan5kKBwqI48KWkLmUSJt1140kVeoUz2KUr r83wog/NZ/8rIDHGEriIRSIF5qRp9iPh3j0Me4YbXbDhhoLq2tzG9KLIPd28OS5eu3Gk OwuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788320877; x=1788925677; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Kuo/kMplXQTmim1xgq1AGrQV22Ee2W7pS7GcxAjds0A=; b=NvfUT+RFTVyJsKCzUwpiXk1jaZWnmgjrJr0nAn+Mga5agArO9hddAbmrHbukQu/DQF mOzpPOsOVFYWS2a2xgkVpxkrRmb/Gngs248YT7HnsSNg6K8MNRExrxfXT1TXTSz0fmx9 uJmTbeIZ/dWvcvIy9EgbY7vGtoka4U0zyvJN2vtyGOitd9E28QzIks1pcdVqAOkt99AH Y99p+EU3DLGyjv1xM6G9OOHWxxQk34ebYAjkopwwrynahwfF3m1YmJ6NRf/o5pSnWi/w fcfUkAxbKq76LCS1PcFpJR7f/EhdloBSxABwYl82dTnGdVH31yzjJucxAGNrPWacKWZF trAQ== X-Forwarded-Encrypted: i=1; AKwUvBzFSro0RIHefeVtVxi8/J3KwnfPGNtsuMRBH/YEayjDiUpjnQPm9lBGfZdkImjD/a9EX0smpyt2GfldFQ==@sourceware.org X-Gm-Message-State: AFuF++mctWpWNcdIVLIyDy7un3Zwarq7gkld3FpiegYX/FoLC9NE87QH cKiJ4E1oiNhuerp3+QYTbuZ7QVGGjgt0BnAz7YWSJyBx+YiFvmkPNWEcANayelUYBCzxUxAlxgt 2qH1xZuOvPoTyhtffItjG0E3FaJLaIvARrfmFRze2rtDn8X13KRe7LPkuvFLkbUL40uOEACRq X-Gm-Gg: AYBFou18RArpuKa3Cga4hWnA4yqk4uWhxJgOIX+G5nHcE+Sqpp+ub3Lr5q6JLmhaJyl fYpZKT8xViYmxHa77lOSuFTsaFf24ogp8m1hoEdxLsCUzyssUkeZfjX138moIBUfHBNr0umj9u8 aeuygW/o+ov16DGDjd9QEWo+2VkIxIl+5zfHTO2GWfmXnNgI+TSKaJbPLkcp2TOVDp4stAfO1mz PgpCL5l4UCAyvzA6d6C567+gnvJnPpJBD+LDtjieGMj2hFE4BuxrQCw9oL72+LL7AkmyxWh9E10 xD5oPb/t6vI0/9DbWHAFWIjsLj6724TZfWbsF3vmMSJV4t+gh/sDeTqC8JGsa8pUmKxz7A99FZN 6e1ZSet5X9qK17og= X-Received: by 2002:a17:90b:1a8a:b0:385:393e:7124 with SMTP id 98e67ed59e1d1-39aee0e5de8mr2565935a91.14.1788320876872; Tue, 01 Sep 2026 20:47:56 -0700 (PDT) X-Received: by 2002:a17:90b:1a8a:b0:385:393e:7124 with SMTP id 98e67ed59e1d1-39aee0e5de8mr2565886a91.14.1788320876362; Tue, 01 Sep 2026 20:47:56 -0700 (PDT) Received: from [172.31.0.28] ([136.38.201.137]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-14310adaeaasm754402c88.10.2026.09.01.20.47.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Sep 2026 20:47:55 -0700 (PDT) Message-ID: Date: Tue, 1 Sep 2026 21:47:26 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] H8/300: sim: Fix simulator hang caused by qsort on Windows/MinGW To: Jan Dubiec , gdb-patches@sourceware.org Cc: Tom Tromey References: <20260901071022.1682657-1-jdx@o2.pl> Content-Language: en-US From: Jeff Law In-Reply-To: <20260901071022.1682657-1-jdx@o2.pl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Authority-Analysis: v=2.4 cv=T968ifKQ c=1 sm=1 tr=0 ts=6a979c6d cx=c_pps a=vVfyC5vLCtgYJKYeQD43oA==:117 a=asGLMfRmzhnGNxaIYohjRg==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=Nr4ERqS5kGzzFFl8W4EA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=rl5im9kqc5Lf4LNbBjHf:22 X-Proofpoint-ORIG-GUID: lpVLmob3u-L-7X3F3L294Q6PFRXvZbn7 X-Proofpoint-Spam-Info: AW1haW4tMjYwOTAyMDAzMCBTYWx0ZWRfXxdcHuUi36vDT aA/514xzdIeCd8nrBnCh/NPgyJFkoYpEPZ/R+cUi+1LjZhL2LXuYrGrHVvb+nYCsmJYIj7N7pmF Y8XO6BMsnU98Gn9sGRHvOnFoOBVJWbc= X-Proofpoint-GUID: lpVLmob3u-L-7X3F3L294Q6PFRXvZbn7 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTAyMDAzMCBTYWx0ZWRfXwvybqrn4DpEu B4KdS0qarcFDutiAxFn3XpJEnKwulQXTYJi5J0FlnVBtry+d0L7sDncdGavj0L63Lkj+X9o6Bcr 6Y/AN552GqPpquqnpQhnvNlJ2FcKy5b3+GUoTG7QEtrTO2CkfRKOCtDvvOzCu4KHhY33LknX6Hh nQ+u7XcxwSmDR1cu+MubOrwnR59OFw3AL4yAPKXCbkz0UW3SCGcVgBfREk0qiNCQXdbq6+nMNnm oIU8v2CZ4qwT2zhXsppAzCL/EhV0rHsWnlwGqQ3NEqydscNnYlzA2N8kVwqmTj+fWhZXYUNgefw aFcEkvGuvLNL9EC8DXPJ8tUmYyT7tgULG9cuPQnS7Jq1yPA2/70Y0HP23vnT13vT7irLcUoyGpT G49WgKK9/vKMqzJQhVfdqI9nbRfqGmEJttD9FVOFTRUwQIG9RVWlwvWrUjQ0myQ7FUzUk4KGl2H drViGAFILE/XiLW120g== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-01_06,2026-09-01_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 adultscore=0 clxscore=1015 phishscore=0 priorityscore=1501 impostorscore=0 bulkscore=0 spamscore=0 malwarescore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2609020030 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 9/1/26 1:05 AM, Jan Dubiec wrote: > On Windows, qsort() uses an unstable sorting algorithm, which results > in a "shuffled" opcode table rather than a properly sorted one, causing > the entire simulator to hang. > > The simulator happens to work on Linux, but this behavior is not > guaranteed, because the glibc documentation clearly states that "If > two elements compare equal, their order after sorting is unpredictable." > > This patch introduces two additional sort keys to the instruction > comparator function, making the resulting opcode table as close as > possible to the one that would be produced by a stable sorting algorithm. Looks sensible to me (I believe the code in question is mine).  I'm not sure what privs I've got for the H8 in the sim repo these days. So wait for other feedback rather than pushing immediately. One class of pure formatting nit you should probably fix: > + > + /* The 3rd sort key */ > + cmp = strcmp(p1->name, p2->name); GNU style guidelines require a space between the function name and the open paren for the argument list.  The same nit appears several times in this patch (strlen, strchr, strncmp calls) Jeff