aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2017-04-13 13:05:09 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2017-04-13 13:05:09 +0200
commit031fbdb9c9754bf028dffafa43508d3525428327 (patch)
tree38e799865db0b59b04bdcba32e7ec66bb0463b8c /gcc/dwarf2out.c
parentfb81a61b15689be318482bdecb8bbbb2017523ed (diff)
downloadgcc-031fbdb9c9754bf028dffafa43508d3525428327.zip
gcc-031fbdb9c9754bf028dffafa43508d3525428327.tar.gz
gcc-031fbdb9c9754bf028dffafa43508d3525428327.tar.bz2
re PR debug/80321 (infinite recursion with inlining of nested function and debug info)
PR debug/80321 * dwarf2out.c (decls_for_scope): Ignore declarations of current_function_decl in BLOCK_NONLOCALIZED_VARS. * gcc.dg/debug/pr80321.c: New test. 2017-04-13 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/debug10.adb: New test. * gnat.dg/debug10_pkg.ads: New helper. From-SVN: r246900
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 8c3b186..89d1872 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -24889,7 +24889,12 @@ decls_for_scope (tree stmt, dw_die_ref context_die)
for (i = 0; i < BLOCK_NUM_NONLOCALIZED_VARS (stmt); i++)
{
decl = BLOCK_NONLOCALIZED_VAR (stmt, i);
- if (TREE_CODE (decl) == FUNCTION_DECL)
+ if (decl == current_function_decl)
+ /* Ignore declarations of the current function, while they
+ are declarations, gen_subprogram_die would treat them
+ as definitions again, because they are equal to
+ current_function_decl and endlessly recurse. */;
+ else if (TREE_CODE (decl) == FUNCTION_DECL)
process_scope_var (stmt, decl, NULL_TREE, context_die);
else
process_scope_var (stmt, NULL_TREE, decl, context_die);