aboutsummaryrefslogtreecommitdiff
path: root/gcc/lra-int.h
diff options
context:
space:
mode:
authorNathaniel Shead <nathanieloshead@gmail.com>2025-02-10 22:15:30 +1100
committerNathaniel Shead <nathanieloshead@gmail.com>2025-02-11 22:26:52 +1100
commitef83fae50d8f085fe8440bfa595875a2e2329871 (patch)
treecf2c81c3f50f24bf30a0c558e1c3b7eeb40c0441 /gcc/lra-int.h
parent7317fc0b03380a83ad03a5fc4fabef5f38c44c9d (diff)
downloadgcc-ef83fae50d8f085fe8440bfa595875a2e2329871.zip
gcc-ef83fae50d8f085fe8440bfa595875a2e2329871.tar.gz
gcc-ef83fae50d8f085fe8440bfa595875a2e2329871.tar.bz2
c++: Fix use-after-free of replaced friend instantiation [PR118807]
When instantiating a friend function, we call register_specialization which adds it to the DECL_TEMPLATE_INSTANTIATIONS of the template. However, in some circumstances we might immediately call pushdecl and find an existing specialisation. In this case, when reregistering the specialisation we also need to update the DECL_TEMPLATE_INSTANTIATIONS list so that we don't try to access the freed spec again later. PR c++/118807 gcc/cp/ChangeLog: * pt.cc (reregister_specialization): Remove spec from DECL_TEMPLATE_INSTANTIATIONS. gcc/testsuite/ChangeLog: * g++.dg/modules/pr118807.C: New test. Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com> Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/lra-int.h')
0 files changed, 0 insertions, 0 deletions