From patchwork Mon Aug 5 18:29:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dimitar Dimitrov X-Patchwork-Id: 1969147 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=dinux.eu header.i=@dinux.eu header.a=rsa-sha256 header.s=default header.b=HDhhlO8q; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wd4js5Ldtz1yZb for ; Tue, 6 Aug 2024 04:30:09 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7E96F385841E for ; Mon, 5 Aug 2024 18:30:07 +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 E50683858401 for ; Mon, 5 Aug 2024 18:29:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E50683858401 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dinux.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dinux.eu ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E50683858401 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=217.174.156.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722882587; cv=none; b=kpjhY6it0T7XZh1xPse32toqkYTOyGMc6ejJkV2E1LNHx1b0Hzc9w6R9CmejYKnncrEkdpOtU9Pzs6H2OgCPlgkvc3al2b21pJDAht4MVoGVdSiDgxa0W1UptVgzT2vpZcLjXqsqcvUyxKWtEjpRGSLQuIeFUTYxq7Wy2V34Na8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722882587; c=relaxed/simple; bh=/H+uUmAHeokajfjgi+tsFe2cpPoxcb7rtyddA4Ee44Q=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qnkrBQd/jlRMY2B1/Ghqfw0rI2fn6BID52XFLzFL1nl/XdQSl5cay/xaPQH+LjD/B4WsL9NfLOILeuTcxayZZtalWdM2aWrh5t3kD2x0hxGnUironVuS8/J/ULtL5VssXzOi09G9LLUf56gnqKeG1p8bwBhRRYyRfx2qVCnsa1k= ARC-Authentication-Results: i=1; server2.sourceware.org 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=1VjoDTSzY8TdrVQU6zEw0q88AwtyZicj8pwODf2g+Ws=; b=HDhhlO8qCv2F4J0nFTKCmFjkG/ nEPj1zBMhnM1kmvrses21zNMdcvN/+3Bs61YAx/IqAnrW4nm8zKI12oLyp7taX0HDYTex0Pr7Y5Vf hOLv4PiilWmuA9+PxfKlvSK6cJc0j0FFfNaMiJkj01JzYUu9WDG3+jzCqRQj6DDef5PqGlpmGonGn +SF8EpG6KxqQdv/qWLWmjjtYheplypZ+9vDH2W/8d57EP/9l8uIMgpL3Y35D3gk800nMcjPzhwCfg AUzTUmq838EjK8CDzABLyd/nabqc5Fh+uYq6Tp7FKG3G82uNUtBkySuQ6Ht6wq5TF4f/RJXh7DE0K jeJ7krPg==; Received: from [95.42.20.142] (port=48544 helo=kendros.lan) by server28.superhosting.bg with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96.2) (envelope-from ) id 1sb2Sj-00054j-1U; Mon, 05 Aug 2024 21:29:43 +0300 From: Dimitar Dimitrov To: gcc-patches@gcc.gnu.org Cc: Dimitar Dimitrov Subject: [PATCH] testsuite: Fix struct size check [PR116155] Date: Mon, 5 Aug 2024 21:29:35 +0300 Message-ID: <20240805182935.760781-1-dimitar@dinux.eu> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 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.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org The size of "struct only_fam_2" is dependent on the alignment of the flexible array member "b", and not on the type of the preceding bit-fields. For most targets the two are equal. But on default_packed targets like pru-unknown-elf, the alignment of int is not equal to the size of int, so the test failed. Patch was suggested by Qing Zhao. Tested on pru-unknown-elf and x86_64-pc-linux-gnu. Ok for master? PR testsuite/116155 gcc/testsuite/ChangeLog: * c-c++-common/fam-in-union-alone-in-struct-1.c: Adjust check to account for default_packed targets. Signed-off-by: Dimitar Dimitrov --- gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-1.c b/gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-1.c index 39ebf17850b..9979e96fe70 100644 --- a/gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-1.c +++ b/gcc/testsuite/c-c++-common/fam-in-union-alone-in-struct-1.c @@ -45,7 +45,7 @@ int main () __builtin_abort (); if (sizeof (struct only_fam) != 0) __builtin_abort (); - if (sizeof (struct only_fam_2) != sizeof (int)) + if (sizeof (struct only_fam_2) != __alignof__ (int)) __builtin_abort (); return 0; }