]> gcc.gnu.org Git - gcc.git/commit
c++: Fix up ICE in emit_support_tinfo_1 [PR109042]
authorJakub Jelinek <jakub@redhat.com>
Tue, 7 Mar 2023 15:28:20 +0000 (16:28 +0100)
committerJakub Jelinek <jakub@redhat.com>
Tue, 7 Mar 2023 15:28:20 +0000 (16:28 +0100)
commit0d573c1f002fa77a4483aa9ebe310746a313082e
treef4ba156eb343dfe00aa0ad0a04ec2e41279942a4
parente4692319fd5fc7d740436e8bb338f44cb8df6c58
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  <jakub@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.
gcc/cp/decl2.cc
gcc/cp/rtti.cc
gcc/testsuite/g++.dg/rtti/pr109042.C [new file with mode: 0644]
This page took 0.069931 seconds and 6 git commands to generate.