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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:0d573c1f002fa77a4483aa9ebe310746a313082e

commit r13-6527-g0d573c1f002fa77a4483aa9ebe310746a313082e
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Tue Mar 7 16:28:20 2023 +0100

    c++: Fix up ICE in emit_support_tinfo_1 [PR109042]

    In my recent rtti.cc change I assumed when emitting the support tinfos
    that the tinfos for the fundamental types haven't been created yet.
    Normally (in libsupc++.a (fundamental_type_info.o)) that is the case,
    but as can be seen on the testcase, one can violate it by using typeid
    etc. in the same TU and do it before ~__fundamental_type_info ()
    definition.

    The following patch fixes that by popping from unemitted_tinfo_decls
    only in the normal case when it is there, and treating non-NULL
    DECL_INITIAL on a tinfo node as indication that emit_tinfo_decl has
    processed it already.

    2023-03-07  Jakub Jelinek  <ja...@redhat.com>

            PR c++/109042
            * rtti.cc (emit_support_tinfo_1): Don't assert that last
            unemitted_tinfo_decls element is tinfo, instead pop from it only in
            that case.
            * decl2.cc (c_parse_final_cleanups): Don't call emit_tinfo_decl
            for unemitted_tinfO_decls which have already non-NULL DECL_INITIAL.

            * g++.dg/rtti/pr109042.C: New test.

Reply via email to