From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id 7B1A7385E021 for ; Mon, 23 May 2022 08:04:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7B1A7385E021 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 044B11595; Mon, 23 May 2022 01:04:11 -0700 (PDT) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.37]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7A2123F73D; Mon, 23 May 2022 01:04:10 -0700 (PDT) From: Richard Sandiford To: Dimitar Dimitrov Mail-Followup-To: Dimitar Dimitrov , gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] testsuite: mallign: Handle word size of 1 byte References: <20220508073104.1698197-2-dimitar@dinux.eu> Date: Mon, 23 May 2022 09:04:09 +0100 In-Reply-To: (Dimitar Dimitrov's message of "Mon, 16 May 2022 20:18:53 +0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 23 May 2022 08:04:14 -0000 Dimitar Dimitrov writes: > On Sun, May 08, 2022 at 10:31:04AM +0300, Dimitar Dimitrov wrote: >> This patch fixes a spurious warning for pru-unknown-elf target: >> gcc/testsuite/gcc.dg/mallign.c:12:27: warning: ignoring return value of 'malloc' declared with attribute 'warn_unused_result' [-Wunused-result] >> >> For 8-bit targets the resulting mask ignores all bits in the value >> returned by malloc. Fix by first checking the target word size. >> >> Sanity checked that there are no new failures on x86_64-pc-linux-gnu. >> >> Ok for trunk? > > Ping. Does this count as an obvious fix? > >> >> gcc/testsuite/ChangeLog: >> >> * gcc.dg/mallign.c: Skip check if sizeof(word)==1. OK, thanks. Sorry for the slow review. Richard >> >> Signed-off-by: Dimitar Dimitrov >> --- >> gcc/testsuite/gcc.dg/mallign.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/gcc/testsuite/gcc.dg/mallign.c b/gcc/testsuite/gcc.dg/mallign.c >> index 349cdaa343f..9a18a00c3b0 100644 >> --- a/gcc/testsuite/gcc.dg/mallign.c >> +++ b/gcc/testsuite/gcc.dg/mallign.c >> @@ -9,7 +9,7 @@ typedef int word __attribute__((mode(word))); >> >> int main() >> { >> - if ((__UINTPTR_TYPE__)malloc (1) & (sizeof(word)-1)) >> + if ((sizeof(word)>1) && ((__UINTPTR_TYPE__)malloc (1) & (sizeof(word)-1))) >> abort (); >> return 0; >> } >> -- >> 2.35.1 >>