]> git.ipfire.org Git - thirdparty/gcc.git/commit
c++/modules: Propagate BINDING_VECTOR_*_DUPS_P on realloc [PR99242]
authorNathaniel Shead <nathanieloshead@gmail.com>
Mon, 8 Jul 2024 12:25:17 +0000 (22:25 +1000)
committerNathaniel Shead <nathanieloshead@gmail.com>
Wed, 17 Jul 2024 01:21:58 +0000 (11:21 +1000)
commit1aa0f1627857c3e2d90982bdb07ca78ca10b26f3
tree9036f0581f412fef640e346dbbeb70725f11dbad
parent72bce1fbef6b03e875501dd953dc8cc40f395d31
c++/modules: Propagate BINDING_VECTOR_*_DUPS_P on realloc [PR99242]

When importing modules, when a binding vector for a name runs out of
slots it gets reallocated with a larger size, and existing bindings are
copied across.  However, the flags to indicate whether deduping needs to
occur did not: this causes ICEs, as it allows a duplicate binding to be
added which then violates assumptions later on.

PR c++/99242

gcc/cp/ChangeLog:

* name-lookup.cc (append_imported_binding_slot): Propagate dups
flags.

gcc/testsuite/ChangeLog:

* g++.dg/modules/pr99242_a.H: New test.
* g++.dg/modules/pr99242_b.H: New test.
* g++.dg/modules/pr99242_c.H: New test.
* g++.dg/modules/pr99242_d.C: New test.

Signed-off-by: Nathaniel Shead <nathanieloshead@gmail.com>
gcc/cp/name-lookup.cc
gcc/testsuite/g++.dg/modules/pr99242_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr99242_b.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr99242_c.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr99242_d.C [new file with mode: 0644]