summaryrefslogtreecommitdiff
path: root/gcc/auto-profile.c
diff options
context:
space:
mode:
authorak <ak@138bc75d-0d04-0410-961f-82ee72b054a4>2017-12-11 16:13:53 +0000
committerak <ak@138bc75d-0d04-0410-961f-82ee72b054a4>2017-12-11 16:13:53 +0000
commit678d168f7ad0feea94a3209db2060e5b7617cee6 (patch)
tree282ac512ba37da0ef146f2f06023ddd149dd17e4 /gcc/auto-profile.c
parent729b987e0a5da1b4cd7b2c1b1930c0a5b6939e28 (diff)
downloadgcc-678d168f7ad0feea94a3209db2060e5b7617cee6.tar.gz
Fix stack overflow with autofdo (PR83355)
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. gcc/: 2017-12-11 Andi Kleen <ak@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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255540 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/auto-profile.c')
-rw-r--r--gcc/auto-profile.c2
1 files changed, 1 insertions, 1 deletions
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;