From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) by sourceware.org (Postfix) with ESMTPS id 9500A3858D28 for ; Tue, 31 Jan 2023 06:10:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9500A3858D28 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.alibaba.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=cooper.qu@linux.alibaba.com;NM=1;PH=DS;RN=3;SR=0;TI=SMTPD_---0VaVQoYV_1675145440; Received: from localhost(mailfrom:cooper.qu@linux.alibaba.com fp:SMTPD_---0VaVQoYV_1675145440) by smtp.aliyun-inc.com; Tue, 31 Jan 2023 14:10:40 +0800 From: Xianmiao Qu To: gcc-patches@gcc.gnu.org, rguenther@suse.de Cc: Xianmiao Qu Subject: [PATCH] testsuite: Fix pr108574-3.c failed in arch where sign defaults to unsigned. Date: Tue, 31 Jan 2023 14:10:38 +0800 Message-Id: <20230131061038.97059-1-cooper.qu@linux.alibaba.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-20.9 required=5.0 tests=BAYES_00,ENV_AND_HDR_SPF_MATCH,GIT_PATCH_0,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: In the architecture where sign defaults to unsigned, the 'f' will be zero extended to int type in the expression 'd = ~(f & ~2880764155)', then the 'd' will become -1 wich cause the case to fail. So it's ok for the architectures where sign defaults to signed like x86, but failed for the architectures where sign defaults to unsigned like arm and csky. Change char to signed char to avoid this problem. gcc/testsuite: * gcc.dg/torture/pr108574-3.c (b, f): Change type from char to signed char. --- gcc/testsuite/gcc.dg/torture/pr108574-3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/gcc.dg/torture/pr108574-3.c b/gcc/testsuite/gcc.dg/torture/pr108574-3.c index 3c9146e31ac..b4d5dae9f80 100644 --- a/gcc/testsuite/gcc.dg/torture/pr108574-3.c +++ b/gcc/testsuite/gcc.dg/torture/pr108574-3.c @@ -1,7 +1,7 @@ /* { dg-do run } */ int a = 3557301289, d; -char b, f; +signed char b, f; unsigned short c = 241; short e, g; static void h() { -- 2.32.1 (Apple Git-133)