From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id i/x2IMr6xmr9BxMAWB0awg (envelope-from ) for ; Wed, 07 Oct 2026 22:07:06 -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=ef+iGKXN; 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=DqA6/wNe; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 719201E051; Wed, 07 Oct 2026 22:07:06 -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 [IPv6:2620:52:6:3111::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 131A71E047 for ; Wed, 07 Oct 2026 22:07:02 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7290A4BA2E2B for ; Thu, 8 Oct 2026 02:07:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7290A4BA2E2B 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=ef+iGKXN; 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=DqA6/wNe Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by sourceware.org (Postfix) with ESMTPS id 99A314BA2E09 for ; Thu, 8 Oct 2026 02:05:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 99A314BA2E09 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 99A314BA2E09 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=1791425139; cv=none; b=ZnNaGTKBo2bmy0g3dmUHnl1j4Dpl15P5cZ76VRE24MvnZMYdeEuH2AlzpHMZz0UUb7tokrzhrWHn6zJ+15SrspCpC+mBeH2prYGG9j1YxStIIqc6bS+hQr17MQ0RxrCA2wd0KnKanG/S6t9UvFzWSru0vI578p+A8q53JclisWQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1791425139; c=relaxed/simple; bh=ZwfmsZCWfDhXRS9tRPttUfTy1JQWn0pePfJprYItThs=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=Wnp1ObGODkcZdngehUQOJuCND3bcHe2Cy/P56e0uIDyzwIrZnDGTV/eGWrJ8AMFp112lotFp5JsurefBFZBkt46YW5n/HwJUZrnoAHrVmosbUeGMdbRzZjx76bdhWnmnEbD5h05TiWCtn2w1naH+3qtYgUYE/h2gC0/ZhgPnoCY= 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=ef+iGKXN; 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=DqA6/wNe DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 99A314BA2E09 Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6981hvU5608354 for ; Thu, 8 Oct 2026 02:05:38 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= JH/yCN4Oi1IzMOB2tH8aYjWhOya9ILzn8yiocKk+cDE=; b=ef+iGKXNaB3awPgt c8KIL8smC9+ewUnKILMGjI64sA//BsakbSpAheomPG2cbZ6B4Z3JXHuKjNES4XMi fnXibEvKQXCK+MQwoSeeZjSKxtirZGleXhFQ5Rnmk6GnG7CBJMlTm3b7prwPzBeg L4iwKav5VhuFZ1UkU/EPbkqfvuTvzY8MVJ7PQN4yN73sSTbvFJFxZaLu5EB2uLyL S73Qc0ut4fviOQQ1Wv5DuLJxIR1FiNHTyX1evkIKVLP/12JszgAlMuOPcxYnKaIU 7RfirdcO/+OF8DaLiu9C38FmbX8H8LxMiddeATF+iVlcsKo528DZ1gp8yd2nXwu1 pN3ApA== Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4h5xe2rnjh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 08 Oct 2026 02:05:38 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-3515266f6eeso1904969eec.0 for ; Wed, 07 Oct 2026 19:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1791425137; x=1792029937; 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=JH/yCN4Oi1IzMOB2tH8aYjWhOya9ILzn8yiocKk+cDE=; b=DqA6/wNels94J9I+bXSYdR0FfzWf4Y1A7x4rc3R0UhwF1F6Al4djbdRT43Qys35qnP 5Y1laKlQwiyn44O37V16nZgfDxgjAILJByr7en/rEBTbXIv3Q3wNixJ0VwMO+zWPqnqi uyf/HNWyxnHcrQGekwqpgtjZ+s6P5znu0Ca0FFECjZcf64rCbTdPo4TXEyw6PxnXI5NU xRKoHEvoi+6UTpqq6XOmarwUVdYUID0TjcbW6a9ta2GHniCiVG0xiIMEh/hx3wgOuMte dkI+Ek1B6+4XbFhZED0GtcXajfbFM4gT3ZUSwTWEUzUT4M74pNgtUhbLm8X+X5qSTC5Y Sofg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791425137; x=1792029937; 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=JH/yCN4Oi1IzMOB2tH8aYjWhOya9ILzn8yiocKk+cDE=; b=SbyOe6igv5LoKNDTJGsnRxZ6S28p9wc4gPmlSCQPQmPlT5LQ5PpzVGe6EGgnDCFJTr n/TerfMftv+q9psgfOD4k3zeYgmpS7Tz7CLnzVQfp5+jFn6zLcLHw1PrMAD/YN8+ef9U c0akjhl733iE7XupzIpj3F2iKVGg6NqoD9YxOZEQ3Hcl/YGbh5qDdIq2WPko43APyusN F7qx16AktwObH8/Hv/cUFk0iu7qXcSSdSs4m1iFxhUK954OCms5HOMuoaOu/giW4xJaQ 59TQBn1jeXe5Nbx4NAxBhbWkYwEaPh1T7V/NvUp73ImEmUYT8xGe5CJi9MZOXz2p7Vfq DzCw== X-Forwarded-Encrypted: i=1; AKwUvBzJylHahyRQN9pohGqHeBpLtafZjI55Z6svxU71iDHLaW+gJdzVbYd6bBrlSP2ypewbVR8oIr6OX/+4Yg==@sourceware.org X-Gm-Message-State: AFuF++lb2+xz8XwnNYJnJh785AKnyNFsI6xWSQbyyraUHcgtsot9x+DV d9LYg1y+h2a/7gcGiPgKMLry62AgT0tlko+I8zveFDlbjeUm+rm2kZc62eaxwvBi+pdvj1GqDmR /4PRm8DkqG627u/gXGGJ6FeP5FmEurWuzXTzn58E8SF9rflH4+ikjAQ6ImAdiZCqa3JOXzM18 X-Gm-Gg: AYBFou1TlYGzgqlRUVIv7I84+4uX33fFXNlgVLornC+nU/BX9uHfMbG1XN7XMzL5GsR sMZMSdpbdyiHrerzjQkTldxV4B92dGGn1XOuVPl7Ov6l205kEOFDlpkxDs1r/aUP43J9C53rh32 p57ubKHxCMggAeAw4bsn+t31612fZP29+1FxrPOG7i0LRbTjJWKxqFURyc3PaOZkmrRz2QDz1mP P5psiiep+d7xsdmTJVDrQTwAVf2Vg1P6szEwRhXViaC4Y1G/SqHtN6vT8xv83X7L7YbKzsn4IAs Z0yWbSPr5QlN78dRp2YLB2+MHQ06puIYTeH4w2/WhT8As71tDGE/p/TL7Qm3Yu4MGzUcD4IzcVj 5zLeHfWY4sIJ4Qg== X-Received: by 2002:a05:701b:2919:b0:14f:8e70:fad0 with SMTP id a92af1059eb24-162079a5a16mr4532515c88.33.1791425137291; Wed, 07 Oct 2026 19:05:37 -0700 (PDT) X-Received: by 2002:a05:701b:2919:b0:14f:8e70:fad0 with SMTP id a92af1059eb24-162079a5a16mr4532471c88.33.1791425136202; Wed, 07 Oct 2026 19:05:36 -0700 (PDT) Received: from [172.31.0.30] ([136.38.201.137]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-16169249859sm9079652c88.15.2026.10.07.19.05.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Oct 2026 19:05:35 -0700 (PDT) Message-ID: Date: Wed, 7 Oct 2026 20:04:13 -0600 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [REPOST][PATCH v4] H8/300: sim: Fix simulator hang caused by qsort on Windows/MinGW To: Jan Dubiec , gdb-patches@sourceware.org Cc: Andrew Burgess References: <20261005060545.242055-1-jdx@o2.pl> Content-Language: en-US From: Jeff Law In-Reply-To: <20261005060545.242055-1-jdx@o2.pl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Proofpoint-Spam-Info: AW1haW4tMjYxMDA4MDAwOCBTYWx0ZWRfX3QMyHYzkdzuK y8zq1aT+x0j8COwEpwwber9x2xDer5n3T+ri46E2gUHBHNnfjxX0Y3WnCQA0UP7lLkxARm9dZby d3Zm90A0kvgzUWg2XJQ6b6JMM6BwSY4= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMDA4MDAwOCBTYWx0ZWRfX5vpUHHIRlgtL 4eZY7JNn+GFzuQ4gBqOp9TA/bB8ENCDk0FOhGwA2fR4xUlZbcWBasMYERAmuYd4letyi8RE8M/P G1FX6apLg+0kHY+AMHr1XyyztMDT55Hr+/ezd+nC1oroN3229nU0EOAs9aK1WqTKPxVJ3xv12KY kzANFFpowflo+QUGMDtQmLUPvnRi224qDfQlBStMPSw+cy7QwHznqSZgicOXKeQqS9zaHgcAfrC oNRC0IhC/x2aAE6qIw+sQAPJaM5DjYJ04BBgieWxVovZOovlwKEgaBeUgF48Y38MyuqAGqu/Hxi wjzWGXatlz8gFH5HThoH9SZ7DS3hpZsYDbggk+qUnYXVY8oiPwPS4K4t3zy+xs4lsGHtUgXcpI5 U3jIgC1eYkR95Sh74T/odyPkXUxISNcUw/RUW5irb8VW8rXgB6TqmWjbqasvw5iRuFH6LKA6f43 0M9LmWZXywGB/iWvM9w== X-Proofpoint-ORIG-GUID: CRgTFhuJceCbH9TczzIK1_rTFaptHu4P X-Proofpoint-GUID: CRgTFhuJceCbH9TczzIK1_rTFaptHu4P X-Authority-Analysis: v=2.4 cv=CIm/zhrD c=1 sm=1 tr=0 ts=6ac6fa72 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=asGLMfRmzhnGNxaIYohjRg==:17 a=IkcTkHD0fZMA:10 a=660iZSQnnn4A:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=YMgV9FUhrdKAYTUUvYB2:22 a=ySN_OedeD0lqxDXjNE8A:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 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-10-08_01,2026-10-06_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 lowpriorityscore=0 impostorscore=0 bulkscore=0 adultscore=0 spamscore=0 priorityscore=1501 suspectscore=0 clxscore=1015 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2610020000 definitions=main-2610080008 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 10/5/26 12: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. > > It also fixes an issue in the instruction decoder where, for example, > mov.l @er7+,er1 is recognized as ldm.l @er7+,(er0-er1) if the opcode > table is sorted "the wrong way", i.e. when ldm appears before mov > in the table. > > No regressions were found. This seems generally sensible to me.  I'd probably kill that ldm/stm special case, particularly if the new comparator avoids the problem. I'd instead be more interested in tripping an assert if we ever have two things compare equal jeff