On 08/04/2016 01:07 AM, Marcel Böhme wrote:
Hi Jeff,

Can you take care of the minor issues above, retest & repost?

Sure. I removed the whitespace nits, used XDUPVEC instead of XNEWVEC+memcpy, 
and adjusted the growing heuristics of the new array proctypevec. The revised 
patch is attached below. Bootstrapped and regression tested on 
x86_64-pc-linux-gnu and checked PR71696 is resolved.

+           for (i = 0; i < work -> nproctypes; i++)
+             if (work -> proctypevec [i] == n)
+               success = 0;
So presumably this doesn't happen all that often or this could get expensive
and we'd want something more efficient for searching, right?

It seems, at least for the cases in the Demangler test suite, the loop executes 
never more than one iteration.






Index: libiberty/ChangeLog
===================================================================
--- libiberty/ChangeLog (revision 239112)
+++ libiberty/ChangeLog (working copy)
@@ -1,3 +1,20 @@
+2016-08-04  Marcel Böhme  <boehme.mar...@gmail.com>
+
+       PR c++/71696
+       * cplus-dem.c: Prevent infinite recursion when there is a cycle
+       in the referencing of remembered mangled types.
+       (work_stuff): New stack to keep track of the remembered mangled
+       types that are currently being processed.
+       (push_processed_type): New method to push currently processed
+       remembered type onto the stack.
+       (pop_processed_type): New method to pop currently processed
+       remembered type from the stack.
+       (work_stuff_copy_to_from): Copy values of new variables.
+       (delete_non_B_K_work_stuff): Free stack memory.
+       (demangle_args): Push/Pop currently processed remembered type.
+       (do_type): Do not demangle a cyclic reference and push/pop
+       referenced remembered type.
THanks.  Installed and BZ updated.

jeff

Reply via email to