[Bug tree-optimization/102988] ICE with -fharden-conditional-branches and C++ and pass by reference return value

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Nov 20 05:54:04 GMT 2021


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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Alexandre Oliva <aoliva@gcc.gnu.org>:

https://gcc.gnu.org/g:38e4a361e79a459947540920db645f3d7fa7221a

commit r12-5429-g38e4a361e79a459947540920db645f3d7fa7221a
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Sat Nov 20 02:51:27 2021 -0300

    harden conds: detach without decls

    When we create copies of SSA_NAMEs to hold "detached" copies of the
    values for the hardening tests, we end up with assignments to
    SSA_NAMEs that refer to the same decls.  That would be generally
    desirable, since it enables the variable to be recognized in dumps,
    and makes coalescing more likely if the original variable dies at that
    point.  When the decl is a DECL_BY_REFERENCE, the SSA_NAME holds the
    address of a parm or result, and it's read-only, so we shouldn't
    create assignments to it.  Gimple checkers flag at least the case of
    results.

    This patch arranges for us to avoid referencing the same decls, which
    cures the problem, but retaining the visible association between the
    SSA_NAMEs, by using the same identifier for the copy.


    for  gcc/ChangeLog

            PR tree-optimization/102988
            * gimple-harden-conditionals.cc (detach_value): Copy SSA_NAME
            without decl sharing.

    for  gcc/testsuite/ChangeLog

            PR tree-optimization/102988
            * g++.dg/pr102988.C: New.


More information about the Gcc-bugs mailing list