[Bug tree-optimization/94482] [8/9 Regression] Inserting into vector with optimization enabled on x86 generates incorrect result

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 21 15:42:04 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94482

--- Comment #28 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-8 branch has been updated by Martin Jambor
<jamborm@gcc.gnu.org>:

https://gcc.gnu.org/g:b463ced59535fddeff90d697f869d58e444568fa

commit r8-10194-gb463ced59535fddeff90d697f869d58e444568fa
Author: Martin Jambor <mjambor@suse.cz>
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 94482.

    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  <mjambor@suse.cz>

            Backport from master
            2020-04-09  Martin Jambor  <mjambor@suse.cz>
                        Richard Biener  <rguenther@suse.de>

            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.


More information about the Gcc-bugs mailing list