From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bisque.elm.relay.mailchannels.net (bisque.elm.relay.mailchannels.net [23.83.212.18]) by sourceware.org (Postfix) with ESMTPS id 7B5E53858417 for ; Tue, 19 Dec 2023 23:23:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7B5E53858417 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7B5E53858417 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=23.83.212.18 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1703028196; cv=pass; b=a7mJ1XTpLL+JrJjWN3R9hnz7LVwgPRvaFCwGr4IvzMOvelSZVoh/Prhzc2ydS8SLtgTq8yQ0sYJccg8LW91rrCpgi3o4HTSJRXvnzuIIJTvBDA/JBohNVX7Pum3otbhhqMjx5JOtk3tQakaKnpSr4VgKYSX8uNX7V3bAeZrK4M8= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1703028196; c=relaxed/simple; bh=+6w0Vc1de3nbYLcu8/kxA1altUL5QDSC6FImZOQRVHk=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=o/xnZd58+bvIzY2gN8R6N3nYK+kytr3XDYlugbTz8RI4O+UGZfqZ2dw23woq8Q09FB+9xZ9BLWdj1yPV4AtC8Uq18BVLAQLUDxIuO8bgpKHUiN8/krBxJH1hyA43FwyPPPSYG1tDm8l6RuRDNisHybNF6i1H3h1PNNE5/6Rb48s= ARC-Authentication-Results: i=2; server2.sourceware.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 5425E4C2FCC; Tue, 19 Dec 2023 23:23:13 +0000 (UTC) Received: from pdx1-sub0-mail-a209.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id E263A4C2F8A; Tue, 19 Dec 2023 23:23:12 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1703028192; a=rsa-sha256; cv=none; b=CoP0R0G063gr/g3KuDcnj13D8RBixwfDUIxt0FwNMokkhhly4IOnrqPeAaA3Rgk54thgUL XNlOn7h3q15HgfwuAZHbu1HIsd8omQy3Nwi3zdlBPBiWJEM3fUVlHUeAW0bZ0c2vwjPXcV cRwwOUzY5FlJSAU5SWuF2Gfu3QDLM9j+FXlZpAI39BvrmmF7lrY5b+hXRHEDxEALv49VHm JNI5M2qAhLH7XRlQ8Wu/g2Kj7BnEmU+B3LB53DAy2LS42kFOWXzVcc5FjaMSlVg8h6FD2V k7RkCRNrE6iwGw/+qHaP68Ot19KlOqmsYaTHu8L1AR+BBGnViB6JSTc7GEQy/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1703028192; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=GL/rkgBuNsuYqW1MpZej7EaLu2/QSXZMTQRDRkJyxm8=; b=UdJkCMrCHTlbQkY6Nif5r3+FUpboK9wC/vSf7+t8E2pweddkPjqeSCjH4VRsNVA6iIkehZ kYNDRlIrFebqSeHRwCL5EPJl0hH6w9IcgqIv4TrKXCDki3hWkfsXXWme/lA80Vvj8x6SnG leREcYBsRCOEcED2dO/00QHbtDqElBPEp/Urj1/sT2UH905Uw+bFtQ/8JgaspWeWO+RFtT IuO32HJKs2Wqc+ePQJ2b1zKQpAD/Q1SWzyEVZANjDo1kABqw5eB1/1zgerlEuWndPqg5Q2 j4NMHIqeZvcssarw14qyNKha6yNms6lbK0UYvGQx4QC1Wr8AJhNN4yrM4mYMMA== ARC-Authentication-Results: i=1; rspamd-856c7f878f-27k9j; 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-Keen-Lettuce: 4d97e7ad73434ce8_1703028193168_1898271694 X-MC-Loop-Signature: 1703028193168:2437473491 X-MC-Ingress-Time: 1703028193168 Received: from pdx1-sub0-mail-a209.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.108.178.186 (trex/6.9.2); Tue, 19 Dec 2023 23:23:13 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-02-142-113-138-136.dsl.bell.ca [142.113.138.136]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a209.dreamhost.com (Postfix) with ESMTPSA id 4Svt683x56z66; Tue, 19 Dec 2023 15:23:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1703028192; bh=GL/rkgBuNsuYqW1MpZej7EaLu2/QSXZMTQRDRkJyxm8=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=LMgMEEtwX/Y/vuRpQLK21PYj3VksvRWqH3n3vBcktSxKJvL3U/xK3ECDEWd1ok3L1 hnDYslFgEoAKeCZ4RLLZs9Es8LnfDqS5itB9KZblbcf2sYh1x7imFE7+MoUpjFOb7x G8mMYuXF0KVNsb1rBrmJHIBA7qTbX/W87+Jlv9IwFbB4Ovgh5TdhhnWahsC26k7Ec4 qoR+Ie29MY1/hMPCxuzCkPveJHfT9c5U9bU7++q3JNv03XlTm19g7gwiMkcSy70iTS Grd877NG6kXIY60pT2or52BfcJuETzWqv03K6qxOSVjzKOF35/AK7qc+8fIqgdZF3R wcqB4xkDJW4AQ== Message-ID: <67894ec0-86df-4ab1-afb7-89f820a5863c@gotplt.org> Date: Tue, 19 Dec 2023 18:23:11 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] tree-object-size: Always set computed bit for bdos [PR113012] Content-Language: en-US To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org References: <20231218164252.1963249-1-siddhesh@gotplt.org> From: Siddhesh Poyarekar In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3030.1 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: On 2023-12-19 17:57, Jakub Jelinek wrote: > On Mon, Dec 18, 2023 at 11:42:52AM -0500, Siddhesh Poyarekar wrote: >> It is always safe to set the computed bit for dynamic object sizes at >> the end of collect_object_sizes_for because even in case of a dependency >> loop encountered in nested calls, we have an SSA temporary to actually >> finish the object size expression. The reexamine pass for dynamic >> object sizes is only for propagation of unknowns and gimplification of >> the size expressions, not for loop resolution as in the case of static >> object sizes. >> >> gcc/ChangeLog: >> >> PR tree-optimization/113012 >> * gcc.dg/ubsan/pr113012.c: New test case. >> >> gcc/testsuite/ChangeLog: >> >> PR tree-optimization/113012 >> * tree-object-size.cc (compute_builtin_object_size): Expand >> comment for dynamic object sizes. >> (collect_object_sizes_for): Always set COMPUTED bitmap for >> dynamic object sizes. > > You have the gcc/ChangeLog and gcc/testsuite/ChangeLog hunks swapped, > I think this wouldn't get through pre-commit hook. Oops, fixed. >> --- a/gcc/tree-object-size.cc >> +++ b/gcc/tree-object-size.cc >> @@ -1185,10 +1185,12 @@ compute_builtin_object_size (tree ptr, int object_size_type, >> osi.tos = NULL; >> } >> >> - /* First pass: walk UD chains, compute object sizes that >> - can be computed. osi.reexamine bitmap at the end will >> - contain what variables were found in dependency cycles >> - and therefore need to be reexamined. */ >> + /* First pass: walk UD chains, compute object sizes that can be computed. >> + osi.reexamine bitmap at the end will contain what variables that need > > This wording is weird. > Perhaps ... will contain versions of SSA_NAMEs that need > to be reexamined. ? > Because varno seems to be SSA_NAME_VERSION. Ack, it's unrelated to my change, but fixed since I touched the comment block. >> @@ -1823,11 +1825,16 @@ collect_object_sizes_for (struct object_size_info *osi, tree var) >> gcc_unreachable (); >> } >> >> - if (! reexamine || object_sizes_unknown_p (object_size_type, varno)) >> + /* Dynamic sizes use placeholder temps to return an answer, so it is always >> + * safe to set COMPUTED for them. */ > > We don't use this style of comments, please replace the * at the start of > second line with a space. Oops, fixed. >> + if ((object_size_type & OST_DYNAMIC) >> + || !reexamine || object_sizes_unknown_p (object_size_type, varno)) >> { >> bitmap_set_bit (computed[object_size_type], varno); >> if (!(object_size_type & OST_DYNAMIC)) >> bitmap_clear_bit (osi->reexamine, varno); >> + else if (reexamine) >> + bitmap_set_bit (osi->reexamine, varno); >> } >> else >> { > > Otherwise LGTM, but please wait at least a few weeks before backporting to > 13. OK, I'll push with fixes to trunk in a bit and then push to 13 next year. Thanks, Sid