https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70909

--- Comment #25 from Mark Wielaard <mark at gcc dot gnu.org> ---
(In reply to Markus Trippelsdorf from comment #24)
> (In reply to Mark Wielaard from comment #22)
> > Created attachment 40230 [details]
> > 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.
> 
> You need to allow one more level of recursion. The following variant works
> fine: 

Indeed it does!
Why do we need the extra recursion level?

This prevents crashes for various issues collected in this and other PRs.
The only question is if those mangled symbols are all really bad. There are a
couple that don't demangle, but where the user seems to expect they would. Of
course they certainly don't expect to crash the demangler, so it is an
improvement, but some extra investigation seems necessary.

Reply via email to