From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 982413858D1E for ; Tue, 31 Jan 2023 06:57:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 982413858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id EF5C420280; Tue, 31 Jan 2023 06:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1675148221; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7tmgw8SdpXeOKlIG5urdGzEfG0lNnyrBH16VjnVYlcA=; b=sLEa8XYFpO6zj/EAcDaS0IR2KNJEnZ2QcSoThRNFswJ3cQJgOV/54rHuRWQziTBKdz2dIt rNV9ZKd4DJ50v0x7K6hAnhsjCT5o4r6gsOSzL7736fM4SDeTlF3D+x8RkzqnH/8MCHdqzw ItQbTOik15XluIp6x9arS7772X5x9cE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1675148221; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7tmgw8SdpXeOKlIG5urdGzEfG0lNnyrBH16VjnVYlcA=; b=ohs0qeAyTTpzSInudr0cxb1XkEOchLqr17i4q/w2PmRsjh4Gt1WelmBKVWjc9Y7wTQ+luM xxOqSscn88UVMHAA== Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id D15582C141; Tue, 31 Jan 2023 06:57:01 +0000 (UTC) Date: Tue, 31 Jan 2023 06:57:01 +0000 (UTC) From: Richard Biener To: Xianmiao Qu cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] testsuite: Fix pr108574-3.c failed in arch where sign defaults to unsigned. In-Reply-To: <20230131061038.97059-1-cooper.qu@linux.alibaba.com> Message-ID: References: <20230131061038.97059-1-cooper.qu@linux.alibaba.com> User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP 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: On Tue, 31 Jan 2023, Xianmiao Qu wrote: > 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. Whoops - thanks for fixing! OK. Richard. > 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() { > -- Richard Biener SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman; HRB 36809 (AG Nuernberg)