From patchwork Fri Oct 22 17:50:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jambor X-Patchwork-Id: 1545016 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=rEzXrI03; dkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=BtS+/DO3; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HbX2H1x1Rz9sWJ for ; Sat, 23 Oct 2021 04:50:46 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1A4A6385740B for ; Fri, 22 Oct 2021 17:50:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id CCDC83858416 for ; Fri, 22 Oct 2021 17:50:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CCDC83858416 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 911F221971 for ; Fri, 22 Oct 2021 17:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1634925030; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QgehmR5DOFbBJJYdhwIc2aZ2XddUysWgBY567KUvbJU=; b=rEzXrI03rUjmXmvI7AmBnZC7asb7zhHg9TtV6101YJvetm1Kt+ISYPBI5nF5UbIPNQ0ZRV Rg2jSCIvoqaD78NJkZ8uX/AmyHmcjNHbYd/DgaQhU9u+Uwut2m6n1YjwL6Pu45Z70zgy2S F354T2lcF9dUC3h6fxt1ywb2C3GOOMY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1634925030; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QgehmR5DOFbBJJYdhwIc2aZ2XddUysWgBY567KUvbJU=; b=BtS+/DO3wxzgIpJ1mCD+5KHQTcQ3kZW+/CVJDP72+hhtExpSmPchleGbhv+d3HfqosFUex BpZhcsL0cyoOj0BQ== Received: from suse.cz (virgil.suse.cz [10.100.13.50]) (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 7E654A3B85 for ; Fri, 22 Oct 2021 17:50:30 +0000 (UTC) From: Martin Jambor To: GCC Patches Cc: Subject: [PATCH] sra: Fix the fix for PR 102505 (PR 102886) In-Reply-To: References: User-Agent: Notmuch/0.33.2 (https://notmuchmail.org) Emacs/27.2 (x86_64-suse-linux-gnu) Date: Fri, 22 Oct 2021 19:50:30 +0200 Message-ID: MIME-Version: 1.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, I was not careful with the fix for PR 102505 and did not craft the check to satisfy the verifier carefully, which lead to PR 102886. (The verifier has the test structured differently and somewhat redundantly, so I could not just copy it). This patch fixes it. I hope it is quite obvious correction of an oversight and so will commit it if survives bootstrap and testing on x86_64-linux and ppc64le-linux. Testcase for this bug is gcc.dg/tree-ssa/sra-18.c (but only on platforms with constant pools). I will backport the two fixes to the release branches squashed. Sorry for the stupid mistake, Martin gcc/ChangeLog: 2021-10-22 Martin Jambor PR tree-optimization/102886 * tree-sra.c (totally_scalarize_subtree): Fix the out of access-condition. --- gcc/tree-sra.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index f561e1a2133..76e3aae405c 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -3288,7 +3288,7 @@ totally_scalarize_subtree (struct access *root) continue; HOST_WIDE_INT pos = root->offset + int_bit_position (fld); - if (pos + fsize > root->size) + if (pos + fsize > root->offset + root->size) return false; enum total_sra_field_state state = total_should_skip_creating_access (root,