diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2025-05-19 23:17:16 +1000 |
---|---|---|
committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2025-05-20 12:11:27 +1000 |
commit | 3ba1b0ac7ccbe7b01811302dc1d50dcdbd7dc2ac (patch) | |
tree | de4c415e8ecd5b0d74a27ced8818a3b821380032 /gcc/coverage.c | |
parent | fedf81ef7b98e5c9ac899b8641bb670746c51205 (diff) | |
download | gcc-3ba1b0ac7ccbe7b01811302dc1d50dcdbd7dc2ac.zip gcc-3ba1b0ac7ccbe7b01811302dc1d50dcdbd7dc2ac.tar.gz gcc-3ba1b0ac7ccbe7b01811302dc1d50dcdbd7dc2ac.tar.bz2 |
c++/modules: Always mark tinfo vars as TREE_ADDRESSABLE [PR120350]
We need to mark type info decls as addressable if we take them by
reference; this is done by walking the declaration during parsing and
marking the decl as needed.
However, with modules we don't stream tinfo decls directly; rather we
stream just their name and type and reconstruct them in the importer
directly. This means that any addressable flags are not propagated, and
we error because TREE_ADDRESSABLE is not set despite taking its address.
But tinfo decls should always have TREE_ADDRESSABLE set, as any attempt
to use the tinfo decl will go through build_address anyway. So this
patch fixes the issue by eagerly marking the constructed decl as
TREE_ADDRESSABLE so that modules gets this flag correctly set as well.
PR c++/120350
gcc/cp/ChangeLog:
* rtti.cc (get_tinfo_decl_direct): Mark TREE_ADDRESSABLE.
gcc/testsuite/ChangeLog:
* g++.dg/modules/tinfo-3_a.H: New test.
* g++.dg/modules/tinfo-3_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit 9a6e5a437f0416627ee516f6ef5929cb30c5e498)
Diffstat (limited to 'gcc/coverage.c')
0 files changed, 0 insertions, 0 deletions