https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70909
--- Comment #22 from Mark Wielaard <mark at gcc dot gnu.org> --- Created attachment 40230 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40230&action=edit d_printing mark/walk/unmark protection (In reply to Nathan Sidwell from comment #21) > Why doesn't a mark/walk/unmark idiom when walking a potentially circular > data structure work here? I.e. add a mutable counter to demangle_component. > Inc/dec at start/end of d_print_comp? IIUC if it gets to >1 there's a > problem. That is a good idea. However it seems things aren't as simple as that. The attached patch implements it, but that produces various testsuite failures: ./test-demangle: 960 tests, 7 failures It might of course be that I messed up the check or that any of these failures really are bad.