aboutsummaryrefslogtreecommitdiff
path: root/maintainer-scripts/branch_changer.py
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2024-08-21 00:50:53 +1000
committerNathaniel Shead <nathanieloshead@gmail.com>2024-10-25 08:13:22 +1100
commit058ed8705a7b38bef2c107b6ff5de243aebd57b4 (patch)
tree30daca72a6c5d6802cf06575b34b3a9ed4696217 /maintainer-scripts/branch_changer.py
parent6713f05a2aeb852c3f4d738c8c5dbad816624323 (diff)
downloadgcc-058ed8705a7b38bef2c107b6ff5de243aebd57b4.zip
gcc-058ed8705a7b38bef2c107b6ff5de243aebd57b4.tar.gz
gcc-058ed8705a7b38bef2c107b6ff5de243aebd57b4.tar.bz2
c++/modules: Prevent maybe_clone_decl being called multiple times [PR115007]
The ICE in the linked PR is caused because maybe_clone_decl is not prepared to be called on a declaration that has already had clones created; what happens otherwise is that start_preparsed_function early exits and never sets up cfun, causing a segfault later on. To fix this we ensure that post_load_processing only calls maybe_clone_decl if TREE_ASM_WRITTEN has not been marked on the declaration yet, and (if maybe_clone_decls succeeds) marks this flag on the decl so that it doesn't get called again later when finalising deferred vague linkage declarations in c_parse_final_cleanups. As a bonus this now allows us to only keep the DECL_SAVED_TREE around in expand_or_defer_fn_1 for modules which have CMIs, which will have benefits for LTO performance in non-interface TUs. For clarity we also update the streaming code to do post_load_decls for maybe in-charge cdtors rather than any DECL_ABSTRACT_P declaration, as this is more accurate to the decls affected by maybe_clone_body. PR c++/115007 gcc/cp/ChangeLog: * module.cc (module_state::read_cluster): Replace DECL_ABSTRACT_P with DECL_MAYBE_IN_CHARGE_CDTOR_P. (post_load_processing): Check and mark TREE_ASM_WRITTEN. * semantics.cc (expand_or_defer_fn_1): Use the more specific module_maybe_has_cmi_p instead of modules_p. gcc/testsuite/ChangeLog: * g++.dg/modules/virt-6_a.C: New test. * g++.dg/modules/virt-6_b.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Diffstat (limited to 'maintainer-scripts/branch_changer.py')
0 files changed, 0 insertions, 0 deletions