From: Andi Kleen <a...@linux.intel.com> g++.dg/bprob* is failing currently with autofdo.
Running in gdb shows that there is a very deep recursion in get_index_by_decl until it overflows the stack. This patch seems to fix it (but not sure why the abstract origin would point to itself) Passes bootstrap and testing on x86_64-linux gcc/: 2017-12-10 Andi Kleen <a...@linux.intel.com> PR gcov-profile/83355 * auto-profile.c (string_table::get_index_by_decl): Don't recurse when abstract origin points to itself. --- gcc/auto-profile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c index 5134a795331..403709bad6b 100644 --- a/gcc/auto-profile.c +++ b/gcc/auto-profile.c @@ -477,7 +477,7 @@ string_table::get_index_by_decl (tree decl) const ret = get_index (lang_hooks.dwarf_name (decl, 0)); if (ret != -1) return ret; - if (DECL_ABSTRACT_ORIGIN (decl)) + if (DECL_ABSTRACT_ORIGIN (decl) && DECL_ABSTRACT_ORIGIN (decl) != decl) return get_index_by_decl (DECL_ABSTRACT_ORIGIN (decl)); return -1; -- 2.15.1