diff options
author | Nathaniel Shead <nathanieloshead@gmail.com> | 2025-04-04 11:56:53 +1100 |
---|---|---|
committer | Nathaniel Shead <nathanieloshead@gmail.com> | 2025-04-05 10:30:32 +1100 |
commit | b8e8829cfb73d7aa009d387ab09bdbab221930d7 (patch) | |
tree | b7cdbcde888427b9c3bd8be75a46e5f1b9782503 /libjava/java/rmi/activation/Activatable.h | |
parent | f4a3ae1ef5ec951f007c4bd530f30e44945c5f0d (diff) | |
download | gcc-b8e8829cfb73d7aa009d387ab09bdbab221930d7.zip gcc-b8e8829cfb73d7aa009d387ab09bdbab221930d7.tar.gz gcc-b8e8829cfb73d7aa009d387ab09bdbab221930d7.tar.bz2 |
c++/modules: Fix divergence in streaming/non-streaming tree walks [PR119608]
Modules streaming walks decls multiple times, first as a non-streaming
walk to find dependencies, and then later to actually emit the decls.
The first walk needs to be done to note locations that will be emitted.
In the PR we are getting a checking ICE because we are streaming a decl
that we didn't initially walk when collecting dependencies, so the
location isn't in the noted locations map. This is because in decl_node
we have a branch where a PARM_DECL that hasn't previously been
referenced gets walked by value only if 'streaming_p ()' is true.
The true root cause here is that the decltype(v) in the testcase refers
to a different PARM_DECL from the one in the declaration that we're
streaming; it's the PARM_DECL from the initial forward-declaration, that
we're not streaming. A proper fix would be to ensure that it gets
remapped to the decl in the definition we're actually emitting, but for
now this workaround fixes the bug (and any other bugs that might
manifest similarly).
PR c++/119608
gcc/cp/ChangeLog:
* module.cc (trees_out::decl_node): Maybe require by-value
walking not just when streaming.
gcc/testsuite/ChangeLog:
* g++.dg/modules/pr119608_a.C: New test.
* g++.dg/modules/pr119608_b.C: New test.
Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'libjava/java/rmi/activation/Activatable.h')
0 files changed, 0 insertions, 0 deletions