From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bumble.birch.relay.mailchannels.net (bumble.birch.relay.mailchannels.net [23.83.209.25]) by sourceware.org (Postfix) with ESMTPS id DE0863858C3A for ; Tue, 11 Jan 2022 09:16:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DE0863858C3A 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 4A1CC621409; Tue, 11 Jan 2022 09:16:04 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id BDB116211B5; Tue, 11 Jan 2022 09:16:03 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a306.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.103.158.70 (trex/6.4.3); Tue, 11 Jan 2022 09:16:04 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Snatch-Hysterical: 592f4a91034fc650_1641892564017_446184463 X-MC-Loop-Signature: 1641892564017:3196419623 X-MC-Ingress-Time: 1641892564017 Received: from rhbox.redhat.com (unknown [1.186.121.232]) (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-a306.dreamhost.com (Postfix) with ESMTPSA id 4JY4mx71Kjz2v; Tue, 11 Jan 2022 01:16:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gotplt.org; s=gotplt.org; t=1641892563; bh=bSmNZ+lefrMPhHMmoP23Kb4xdsg=; h=From:To:Cc:Subject:Date:Content-Transfer-Encoding; b=BuTrjecOvsob8HFn5wQep2iB74NviJsHwVaA+3wMEKcM69DQFHvmM36HAb8GGe4Vs kVzolbexXVEkvFnRvIi9BfdUJVmNKRB9ZZxnUl/NLjAdC1CSNxXGWTJt2mKt9bKLje UJgS2UByiEJlrW8MLdsVFRDwA9GNx/QRzrInB4cg= From: Siddhesh Poyarekar To: gcc-patches@gcc.gnu.org Cc: jakub@redhat.com Subject: [PATCH v6 0/4] __builtin_dynamic_object_size Date: Tue, 11 Jan 2022 14:27:46 +0530 Message-Id: <20220111085750.1900047-1-siddhesh@gotplt.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211109190137.1107736-1-siddhesh@gotplt.org> References: <20211109190137.1107736-1-siddhesh@gotplt.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3030.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_SBL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: , X-List-Received-Date: Tue, 11 Jan 2022 09:16:10 -0000 This patchset enhances the __builtin_dynamic_object_size builtin to produce dynamic expressions for object sizes to improve coverage of _FORTIFY_SOURCE. Testing: -------- This series has been tested with build and test for i686, bootstrap with ubsan and bootstrap+test with x86_64. Additional testing plans (i.e. I've already started to do some of this): - Build packages to compare values returned by __builtin_object_size with the older pass and this new one. Also compare with __builtin_dynamic_object_size. - Expand the list of packages to get more coverage metrics. - Explore performance impact on applications on building with _FORTIFY_SOURCE=3. Changes from v5: - Address review comments - Add a couple more tests for object sizes of pointers passed as parameters. Siddhesh Poyarekar (4): tree-object-size: Support dynamic sizes in conditions tree-object-size: Handle function parameters tree-object-size: Handle GIMPLE_CALL tree-object-size: Dynamic sizes for ADDR_EXPR gcc/builtins.c | 6 +- .../gcc.dg/builtin-dynamic-object-size-0.c | 514 +++++++++++++ .../gcc.dg/builtin-dynamic-object-size-10.c | 2 + .../builtin-dynamic-object-size-5-main.c | 32 + .../gcc.dg/builtin-dynamic-object-size-5.c | 7 +- gcc/testsuite/gcc.dg/builtin-object-size-1.c | 154 +++- gcc/testsuite/gcc.dg/builtin-object-size-2.c | 133 ++++ gcc/testsuite/gcc.dg/builtin-object-size-3.c | 151 ++++ gcc/testsuite/gcc.dg/builtin-object-size-4.c | 93 +++ gcc/testsuite/gcc.dg/builtin-object-size-5.c | 22 +- gcc/tree-object-size.c | 689 +++++++++++++++--- 11 files changed, 1712 insertions(+), 91 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/builtin-dynamic-object-size-0.c create mode 100644 gcc/testsuite/gcc.dg/builtin-dynamic-object-size-5-main.c -- 2.33.1