From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 ; 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 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 List-Id: 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 -- 2.38.1