From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 482113870852; Tue, 21 Apr 2020 15:42:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 482113870852 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1587483725; bh=SreEl6piqvVVSDH7kN8bH6gXVxP8K2/fVbP3sgFQP2A=; h=From:To:Subject:Date:In-Reply-To:References:From; b=As0CSWB+IY7eBgfAVflzj3j36ole8aDfEaAb3fj4ezHH+VpfXyda5QsNR3sxaRgN+ Qr9L6yKN0ZUfWWHIA5u4hmpi5x5RBs0ls/B2MDsQWwC0fNgQ7d5gCddvnGH2PpgZTU kixOHgS/5N/3vOxjEl1C9eIM+yoynVUx5swtVq/Q= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/94482] [8/9 Regression] Inserting into vector with optimization enabled on x86 generates incorrect result Date: Tue, 21 Apr 2020 15:42:04 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 9.3.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jamborm at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Apr 2020 15:42:05 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94482 --- Comment #28 from CVS Commits --- The releases/gcc-8 branch has been updated by Martin Jambor : https://gcc.gnu.org/g:b463ced59535fddeff90d697f869d58e444568fa commit r8-10194-gb463ced59535fddeff90d697f869d58e444568fa Author: Martin Jambor Date: Tue Apr 21 17:41:01 2020 +0200 sra-8: Fix sra_modify_expr handling of partial writes (PR 94482) This is a fairly straightforward backport of the mainline fix for PR 94= 482. When sra_modify_expr is invoked on an expression that modifies only part of the underlying replacement, such as a BIT_FIELD_REF on a LHS of an assignment and the SRA replacement's type is not compatible with what is being replaced (0th operand of the B_F_R in the above example), it does not work properly, basically throwing away the part of the expr that should have stayed intact. This is fixed in two ways. For BIT_FIELD_REFs, which operate on the binary image of the replacement (and so in a way serve as a VIEW_CONVERT_EXPR) we just do not bother with converting. For REALPART_EXPRs and IMAGPART_EXPRs, if the replacement is not a register, we insert a VIEW_CONVERT_EXPR under the complex partial access expression, which is always OK, for loads from registers we take the extra step of converting it to a temporary. This revealed a bug in fwprop which is fixed with the hunk from Richi. This is the only difference from the mainline patch which has two hunks, but the code handling BIT_FIELD_REF is not present in gcc-8. Oh, and the testcase options were changed to what Jakub put there on the mainline to suppress all vector ABI warnings. Bootstrapped and tested on x86_64-linux. 2020-04-21 Martin Jambor Backport from master 2020-04-09 Martin Jambor Richard Biener PR tree-optimization/94482 * tree-sra.c (create_access_replacement): Dump new replacement = with TDF_UID. (sra_modify_expr): Fix handling of cases when the original EXPR writes to only part of the replacement. * tree-ssa-forwprop.c (pass_forwprop::execute): Properly verify the first operand of combinations into REAL/IMAGPART_EXPR and BIT_FIELD_REF. testsuite/ * gcc.dg/torture/pr94482.c: New test. * gcc.dg/tree-ssa/pr94482-2.c: Likewise.=