[Bug jit/95314] Sharing a local reference to a global variable in multiple functions results in location references block not in block tree

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 27 18:30:18 GMT 2020


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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalcolm@gcc.gnu.org>:

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

commit r11-668-gc98bd673ef93836f03491201f1c63929ea429cd6
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Wed May 27 09:44:07 2020 -0400

    jit: use deep unsharing of trees [PR 95314]

    PR jit/95314 reports a internal error inside verify_gimple, which
    turned out to be due to reusing the result of
    gcc_jit_lvalue_get_address in several functions, leading to tree nodes
    shared between multiple function bodies.

    This patch fixes the issue by adopting the "Deep unsharing" strategy
    described in the comment in gimplify.c preceding mostly_copy_tree_r:
    to mark all of the jit "frontend"'s expression tree nodes with
    TREE_VISITED, and to set LANG_HOOKS_DEEP_UNSHARING, so that "they are
    unshared on the first reference within functions when the regular
    unsharing algorithm runs".

    gcc/jit/ChangeLog:
            PR jit/95314
            * dummy-frontend.c (LANG_HOOKS_DEEP_UNSHARING): Define to be true.
            * jit-playback.h (gcc::jit::playback::rvalue): Mark tree node with
            TREE_VISITED.

    gcc/testsuite/ChangeLog:
            PR jit/95314
            * jit.dg/all-non-failing-tests.h: Add test-pr95314-rvalue-reuse.c.
            * jit.dg/test-pr95314-rvalue-reuse.c: New test.


More information about the Gcc-bugs mailing list