diff options
author | Dehao Chen <dehao@google.com> | 2013-04-22 03:16:50 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2013-04-22 03:16:50 +0000 |
commit | 4df1b359654fba6e06af96c1416590acc694a5bb (patch) | |
tree | 26d06b796fc247141f7da25d2233b3aa7bebb339 | |
parent | d37f670d8a69744e11668370e9dde2bfd84e6b12 (diff) |
This patch fixed a bug in getting inline stacks: if there is no
location info attached to a block, we should *not* try to get its
function name because it could result in infinite loop.
2013-04-21 Dehao Chen <dehao@google.com>
* gcc/auto-profile.c(get_function_decl_from_block): Ensure the block
has valid location.
(get_inline_stack_by_stmt): Remove unnecessary call.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/google/gcc-4_7@198122 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/auto-profile.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/auto-profile.c b/gcc/auto-profile.c index 1d8c9d5eb5e..406660e85fd 100644 --- a/gcc/auto-profile.c +++ b/gcc/auto-profile.c @@ -623,6 +623,10 @@ static tree get_function_decl_from_block (tree block) { tree decl; + + if (LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (block) == UNKNOWN_LOCATION)) + return NULL_TREE; + for (decl = BLOCK_ABSTRACT_ORIGIN (block); decl && (TREE_CODE (decl) == BLOCK); decl = BLOCK_ABSTRACT_ORIGIN (decl)) @@ -662,10 +666,12 @@ get_inline_stack_by_stmt (gimple stmt, tree decl, block && (TREE_CODE (block) == BLOCK); block = BLOCK_SUPERCONTEXT (block)) { - tree decl = get_function_decl_from_block (block); - if (LOCATION_LOCUS (BLOCK_SOURCE_LOCATION (block)) == UNKNOWN_LOCATION) - continue; + tree decl; loc = BLOCK_SOURCE_LOCATION (block); + + if (LOCATION_LOCUS (loc) == UNKNOWN_LOCATION) + continue; + decl = get_function_decl_from_block (block); pos_stack[idx].file = expand_location (loc).file; pos_stack[idx].line = expand_location (loc).line; pos_stack[idx - 1].func = |