Message ID | 20221221222554.4141678-1-siddhesh@gotplt.org |
---|---|
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:8188:b0:89:790f:f786 with SMTP id m8csp4945594dye; Wed, 21 Dec 2022 14:26:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXsTFLIslzy1SjACBCgPBTj6URbD1gKmiJG0i80nVICeXaxRm1/TpDWQe9+7+5EZF0HL+x0W X-Received: by 2002:a17:907:d489:b0:7ae:e886:8ccb with SMTP id vj9-20020a170907d48900b007aee8868ccbmr3487335ejc.14.1671661615214; Wed, 21 Dec 2022 14:26:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671661615; cv=pass; d=google.com; s=arc-20160816; b=W5EKnT5bAuTn9ipaedBxTwL1+Mz9mH37EQrpuKliSpKGgAKoaVJDmFsPB7ro+P4O85 RANbPvObQfytpmzwUhXga28LzPkkpjnFsy4+AN9MAu3MauIOwLiW6K82WQS9se3QfeSF IerFqpMBvQiN84Vuipa4rBc8gtxXi7Qd7m8F/VlCiXlBVt8ukArn0pTkr7zKIIDyRNlb QOaxWYl0LPwlX+AweoJHvNilU8wz7VPljmaJdQZw9/jL34yURkqVbaOxads0VfNlJlk3 zlgkXNB882ioBUbTjmoyGUk9s+peOQLbskoUyv/a2fNuZ7n/xZiGRrp0wK68DFAsAKWp bapg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :dmarc-filter:delivered-to; bh=PZyvKEFi991O8p9TGaEVOqij7GxEN6lNAit4Gdy5bkA=; b=ypxOnpZTtMK7px5fZdEPL0hM2IJ8JEaWqkUNHbcn5JHIOStFvN92GqknQfrlgygNdC oHB+Mlzi7t3zJxmqYCEbFf1p0CQfzJdfKz8k6TR8lpnI+HsY/pYtOsZR1MH99d+Wvb6x TF/5Ivu61Moid9ZSfLxeLB6B8ld6jxPchhBHVDJ8VAclS57d+a1TMem3YLQP+Y9jqHaB StUSb3wg60iUmGTJmYkx9tbHkDaDlufO+5M5/CAYjrWvpXRHHsoomFgvXumr6eLadT1A anS+f9pRYMRLs6tkKC4WSTzHNwa6vac1qQs4NE3TI5fX/wKrCKv+e1z74F1V/mKHzNej JCXg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gotplt.org header.s=dreamhost header.b=E3UzDBa0; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id di6-20020a170906730600b007bebf105450si15550443ejc.235.2022.12.21.14.26.54 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Dec 2022 14:26:55 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gotplt.org header.s=dreamhost header.b=E3UzDBa0; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org" Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1C90C384E784 for <ouuuleilei@gmail.com>; Wed, 21 Dec 2022 22:26:36 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from butterfly.birch.relay.mailchannels.net (butterfly.birch.relay.mailchannels.net [23.83.209.27]) by sourceware.org (Postfix) with ESMTPS id E09193858D1E for <gcc-patches@gcc.gnu.org>; Wed, 21 Dec 2022 22:26:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E09193858D1E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 13A2F8C1399; Wed, 21 Dec 2022 22:26:01 +0000 (UTC) Received: from pdx1-sub0-mail-a305.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 9856B8C1BAC; Wed, 21 Dec 2022 22:26:00 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1671661560; a=rsa-sha256; cv=none; b=cuqo8aS350gd589VVeVc+w0WvlB7z+jBdOc885H+kZE1J562EzuoMLkTLPzdQEIcT3ODAb hb3dF5P3/edsuWjtB5/7V0+W7JSNtYm9I3pQjW9sWtkKbgd7wcnxmaNjxXDRLMNtcLnFBX xOBhb/gheWfY2Xc8dcs2ZvL99zOXgT3/Mg+jlosJcoj4GRrTe1ctPh4AIv2+dJEhxAE72O WuIHh9wqESlLtA3PU+0ZV96vXlTCnbzaWpQZ2kaN6ldG0iNQYQ/WdYMcihqQdtYSPquHeN +5IE4kWBZedm5mvrGHzbks5LE0EOUCqx/pceF3JeRTJ6OihagQqFdAPUckzokw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1671661560; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=PZyvKEFi991O8p9TGaEVOqij7GxEN6lNAit4Gdy5bkA=; b=geJyccNcGVilxVuEAiSGTA21nBEqsorAVDZBT9/m3bs0LxpFMBAtChOXuAeD4VBp/cZNoX xaR5C/Zgr1BU73QDG44AD1ffSzebHgUxos96niTszWutFNLiWZ2Pye+YSumLpSv3rapKur IOa3DFOSJmm/eKnpnZ2JaLs6hMSz0j8ppGbZcXHw4d4z4IRS1FlhgswjJQtgD4nMIUCF+H 4RTGeH0QZ4/7miOPo1FIoi6fdfj1aoIGAtoGK8oYuNV6onoysWiwbkE8r3kf4eNNvgeHl1 6rV9zygtvnvDBEf5EoBTWOd7WmTzYQAASJ2FKeD2YWKnp0rVJBrqK7TAh2ukXQ== ARC-Authentication-Results: i=1; rspamd-896578cf5-f2n4z; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Power-Sponge: 7ac954517d85c488_1671661560867_953852018 X-MC-Loop-Signature: 1671661560866:3350436392 X-MC-Ingress-Time: 1671661560866 Received: from pdx1-sub0-mail-a305.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.123.200.84 (trex/6.7.1); Wed, 21 Dec 2022 22:26:00 +0000 Received: from fedora.redhat.com (bras-base-toroon4834w-grc-23-76-68-24-147.dsl.bell.ca [76.68.24.147]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a305.dreamhost.com (Postfix) with ESMTPSA id 4Ncp1h0SYVz2X; Wed, 21 Dec 2022 14:25:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1671661560; bh=PZyvKEFi991O8p9TGaEVOqij7GxEN6lNAit4Gdy5bkA=; h=From:To:Cc:Subject:Date:Content-Transfer-Encoding; b=E3UzDBa0W35t8sHV9V1acj35o6FXZ7C5jioEeJA4DmqWmUybe/f1hDmin38TJP4IF JaNSt/NnDHFb6xzZZI7vrIGTHm5U4zn2AkpFKp/8G2MrutqCYw0gupccI+E902w6Qk zFl9GPRxG67Te8edANY+dVAXHeBHzKlcP/TpmivXnu+iT04Dybl5IYve1fE3b5mPzp OSX+GRhTfcxW3+OY6hzcwbpMoYff9wzzCDO5830Ce8dBY3wVApDGaYYuoyCDzMFahe oljIYWK/crvMd168CIEe2tUFqKiq6ldNcFw19OU1d/12v1ScCm8NbbzHpWFxqSlL1V iM2M7KJoT4uxw== From: Siddhesh Poyarekar <siddhesh@gotplt.org> To: gcc-patches@gcc.gnu.org Cc: jakub@redhat.com Subject: [PATCH 0/2] __bos and flex arrays Date: Wed, 21 Dec 2022 17:25:52 -0500 Message-Id: <20221221222554.4141678-1-siddhesh@gotplt.org> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3031.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752864250146479709?= X-GMAIL-MSGID: =?utf-8?q?1752864250146479709?= |
Series |
__bos and flex arrays
|
|
Message
Siddhesh Poyarekar
Dec. 21, 2022, 10:25 p.m. UTC
Hi, The first patch in the series is just a minor test cleanup that I did to make sure all tests in a test case run (instead of aborting at first failure) and print the ones that failed. The second patch is the actual fix. The patch intends to make __bos/__bdos do the right thing with structs containing flex arrays, either directly or within nested structs and unions. This should improve minimum object size estimation in some cases and also bail out more consistently so that flex arrays don't cause false positives in fortification. I've tested this with a bootstrap on x86_64 and also with --with-build-config=bootstrap-ubsan to make sure that there are no new failures due to this change. Siddhesh Poyarekar (2): testsuite: Run __bos tests to completion tree-object-size: More consistent behaviour with flex arrays .../g++.dg/ext/builtin-object-size1.C | 267 ++++++++-------- .../g++.dg/ext/builtin-object-size2.C | 267 ++++++++-------- .../gcc.dg/builtin-dynamic-object-size-0.c | 14 +- gcc/testsuite/gcc.dg/builtin-object-size-1.c | 263 ++++++++-------- gcc/testsuite/gcc.dg/builtin-object-size-12.c | 12 +- gcc/testsuite/gcc.dg/builtin-object-size-13.c | 17 +- gcc/testsuite/gcc.dg/builtin-object-size-15.c | 11 +- gcc/testsuite/gcc.dg/builtin-object-size-2.c | 287 +++++++++--------- gcc/testsuite/gcc.dg/builtin-object-size-3.c | 263 ++++++++-------- gcc/testsuite/gcc.dg/builtin-object-size-4.c | 267 ++++++++-------- gcc/testsuite/gcc.dg/builtin-object-size-6.c | 267 ++++++++-------- gcc/testsuite/gcc.dg/builtin-object-size-7.c | 52 ++-- gcc/testsuite/gcc.dg/builtin-object-size-8.c | 17 +- .../gcc.dg/builtin-object-size-common.h | 12 + .../gcc.dg/builtin-object-size-flex-common.h | 90 ++++++ ...n-object-size-flex-nested-struct-nonzero.c | 6 + ...ltin-object-size-flex-nested-struct-zero.c | 6 + .../builtin-object-size-flex-nested-struct.c | 22 ++ ...in-object-size-flex-nested-union-nonzero.c | 6 + ...iltin-object-size-flex-nested-union-zero.c | 6 + .../builtin-object-size-flex-nested-union.c | 28 ++ .../gcc.dg/builtin-object-size-flex-nonzero.c | 6 + .../gcc.dg/builtin-object-size-flex-zero.c | 6 + .../gcc.dg/builtin-object-size-flex.c | 18 ++ gcc/testsuite/gcc.dg/pr101836.c | 11 +- gcc/testsuite/gcc.dg/strict-flex-array-3.c | 11 +- gcc/tree-object-size.cc | 150 ++++----- 27 files changed, 1275 insertions(+), 1107 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-common.h create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-flex-common.h create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-flex-nested-struct-nonzero.c create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-flex-nested-struct-zero.c create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-flex-nested-struct.c create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-flex-nested-union-nonzero.c create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-flex-nested-union-zero.c create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-flex-nested-union.c create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-flex-nonzero.c create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-flex-zero.c create mode 100644 gcc/testsuite/gcc.dg/builtin-object-size-flex.c