From patchwork Sun May 8 07:31:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitar Dimitrov X-Patchwork-Id: 53578 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 37CA03839802 for ; Sun, 8 May 2022 07:32:01 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from server28.superhosting.bg (server28.superhosting.bg [217.174.156.11]) by sourceware.org (Postfix) with ESMTPS id CC8B63851C02 for ; Sun, 8 May 2022 07:31:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CC8B63851C02 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dinux.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dinux.eu DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dinux.eu; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=4KD32XlDrsQvDpJETSGUIzT1kpIJUzCRCLbtNi8na9E=; b=TC/1LhsH4HItjDEKYQEmcFewCT 0W2bjN3muyJM6yjpFyEdSUAjGZ4BKH4xR7TWl//qe5HZXkrX4a53N1Vy2HWwMAsaRa9ZLCZy3pH4t BgvYK34eLnytapNOHwgBTgcCRJTG1n3q0W6bml1ZfMMXneMRkUSNmPZlMiXb6dU1p0PQKHfpPNuIn JcRU8nFGZAVHTp1V1dzxfBGYsJNnEhSVtNJTpe2r/oakMe2jBY89KrCElsbQJ6jKi3wKIr3zm5kgq AIedP3KyGuYkrefUHvL6uYs/lfyropzDqMBnl4cNp0EjA69Lu3R19lcoszieEB1gn1XJXtwXAe0+6 aUXjAekA==; Received: from [95.87.234.74] (port=46928 helo=kendros.lan) by server28.superhosting.bg with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nnbNv-0008jl-3p; Sun, 08 May 2022 10:31:21 +0300 From: Dimitar Dimitrov To: gcc-patches@gcc.gnu.org Subject: [PATCH] testsuite: mallign: Handle word size of 1 byte Date: Sun, 8 May 2022 10:31:04 +0300 Message-Id: <20220508073104.1698197-2-dimitar@dinux.eu> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-OutGoing-Spam-Status: No, score=-2.9 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - server28.superhosting.bg X-AntiAbuse: Original Domain - gcc.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - dinux.eu X-Get-Message-Sender-Via: server28.superhosting.bg: authenticated_id: dimitar@dinux.eu X-Authenticated-Sender: server28.superhosting.bg: dimitar@dinux.eu X-Source: X-Source-Args: X-Source-Dir: X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HAS_X_OUTGOING_SPAM_STAT, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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? gcc/testsuite/ChangeLog: * gcc.dg/mallign.c: Skip check if sizeof(word)==1. 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; }