c++: Macros need to be GTY-reachable [PR 99023]
authorNathan Sidwell <nathan@acm.org>
Wed, 17 Feb 2021 18:43:21 +0000 (10:43 -0800)
committerNathan Sidwell <nathan@acm.org>
Wed, 17 Feb 2021 18:47:00 +0000 (10:47 -0800)
commitd8889c99aab4b599aa7ceb7079e69a9766171336
tree9b84f9a3113d2938d448d8ca7c85dfc6b615838e
parente0139b2a912585496f23c352f0e2c56895f78fbf
c++: Macros need to be GTY-reachable [PR 99023]

I'd missed that macros were allocated from GC storage, and that they can
become unattached from an identifier, and therefore not GC-reachable.
And then bad things happen.   Fixed by making the module machinery's
reference vector a GC root.

PR c++/99023
gcc/cp/
* module.cc (struct macro_export): Add GTY markers.
(macro_exports): Likewise, us a va_gc Vector.
gcc/testsuite/
* g++.dg/modules/pr99023_a.H: New.
* g++.dg/modules/pr99023_b.H: New.
gcc/cp/module.cc
gcc/testsuite/g++.dg/modules/pr99023_a.H [new file with mode: 0644]
gcc/testsuite/g++.dg/modules/pr99023_b.H [new file with mode: 0644]