From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id D33503857C50 for ; Thu, 28 Jul 2022 12:35:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D33503857C50 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id A6D531FF3B for ; Thu, 28 Jul 2022 12:35:23 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 88EFF2C141 for ; Thu, 28 Jul 2022 12:35:23 +0000 (UTC) Date: Thu, 28 Jul 2022 12:35:23 +0000 (UTC) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] middle-end/106457 - improve array_at_struct_end_p for array objects User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jul 2022 12:35:26 -0000 Message-ID: <20220728123523.EjlnXYaNYLJ3szsumDXDT9s1mTGNoc31TXPC_qfuyCk@z> Array references to array objects are never at struct end. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR middle-end/106457 * tree.cc (array_at_struct_end_p): Handle array objects specially. --- gcc/tree.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/tree.cc b/gcc/tree.cc index 84000dd8b69..fed1434d141 100644 --- a/gcc/tree.cc +++ b/gcc/tree.cc @@ -12778,6 +12778,10 @@ array_at_struct_end_p (tree ref) && DECL_SIZE_UNIT (ref) && TREE_CODE (DECL_SIZE_UNIT (ref)) == INTEGER_CST) { + /* If the object itself is the array it is not at struct end. */ + if (DECL_P (ref_to_array)) + return false; + /* Check whether the array domain covers all of the available padding. */ poly_int64 offset; -- 2.35.3