[Bug middle-end/95114] [9/10/11 Regression] ICE in obj_type_ref_class for structural-equality types

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 14 18:25:51 GMT 2020


--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Sandiford


commit r10-8495-g74d4c8bda2998e32e6c3b397cc61eadb4b208f0b
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Tue Jul 14 19:24:57 2020 +0100

    ipa-devirt: Fix crash in obj_type_ref_class [PR95114]

    The testcase has failed since r9-5035, because obj_type_ref_class
    tries to look up an ODR type when no ODR type information is
    available.  (The information was available earlier in the
    compilation, but was freed during pass_ipa_free_lang_data.)
    We then crash dereferencing the null get_odr_type result.

    The test passes with -O2.  However, it fails again if -fdump-tree-all
    is used, since obj_type_ref_class is called indirectly from the
    dump routines.

    Other code creates ODR type entries on the fly by passing âtrueâ
    as the insert parameter.  But obj_type_ref_class can't do that
    unconditionally, since it should have no side-effects when used
    from the dumping code.

    Following a suggestion from Honza, this patch adds parameters
    to say whether the routines are being called from dump routines
    and uses those to derive the insert parameter.

            PR middle-end/95114
            * tree.h (virtual_method_call_p): Add a default-false parameter
            that indicates whether the function is being called from dump
            (obj_type_ref_class): Likewise.
            * tree.c (virtual_method_call_p): Likewise.
            * ipa-devirt.c (obj_type_ref_class): Likewise.  Lazily add ODR
            type information for the type when the parameter is false.
            * tree-pretty-print.c (dump_generic_node): Update calls to
            virtual_method_call_p and obj_type_ref_class accordingly.

            PR middle-end/95114
            * g++.target/aarch64/pr95114.C: New test.

More information about the Gcc-bugs mailing list