diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-11-05 03:08:54 +1100 |
---|---|---|
committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2024-11-05 11:28:19 +1100 |
commit | 48ef485eabc8fd3e16d184860ce693816f3919eb (patch) | |
tree | 344060211eaa76d247b82df8a917c3812e2a3181 /gcc/dwarf2codeview.cc | |
parent | ad1f112980040ba7bb8b8d0b9273268d4d710c9e (diff) | |
download | gcc-48ef485eabc8fd3e16d184860ce693816f3919eb.zip gcc-48ef485eabc8fd3e16d184860ce693816f3919eb.tar.gz gcc-48ef485eabc8fd3e16d184860ce693816f3919eb.tar.bz2 |
c++/modules: Handle location exhaustion in write_location [PR105443]
The 'location_t' type currently only stores a limited number of distinct
locations. In some cases, if many modules are imported that sum up to a
large number of locations, we may run out of room to represent new
locations for these imported declarations. In such a case, any new
declarations from the affected modules simply get given a location of
"the module interface as a whole".
'write_location' sometimes gets confused when this happens: it finds that
the location is a location we've noted to get streamed out, but it's
inconsistent whether it's an ordinary location from the current module
or an imported location from a different module. This causes
random-looking locations to be associated with these declarations, and
occasionally (checking-only) ICEs.
This patch fixes the issue by first checking whether an ordinary
location represents a module (rather than a location inside a module);
if so, we instead write the location of the point that we imported this
module. This will continue recursively in case the importing location
also was not able to be stored.
We only need to handle this in the IS_ORDINARY_LOC case: even for
locations originally within macro expansions, the remapping logic for
location exhaustion will make them look like ordinary locs again.
This is a relatively expensive addition, so this new check only occurs
if we've noted resource exhaustion has occurred while preparing imported
line maps, or in checking builds.
PR c++/105443
gcc/cp/ChangeLog:
* module.cc (loc_spans::locs_exhausted_p): New field.
(loc_spans::loc_spans): Initialise it.
(loc_spans::locations_exhausted_p): New function.
(module_state::read_prepare_maps): Move inform into...
(loc_spans::report_location_exhaustion): ...this new function.
(module_state::write_location): Check for writing module
locations stored due to resource exhaustion.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Diffstat (limited to 'gcc/dwarf2codeview.cc')
0 files changed, 0 insertions, 0 deletions