aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-08-31 11:20:54 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-08-31 11:20:54 +0000
commit7488b5779f3d2c350ce7b2bfe8e8cce145efe417 (patch)
treee8de844db1398996203d33b3988887e367d930fc /gcc/dwarf2out.c
parentcae83731bfaa81c72f3a1eb897ce463c46c461aa (diff)
downloadgcc-7488b5779f3d2c350ce7b2bfe8e8cce145efe417.zip
gcc-7488b5779f3d2c350ce7b2bfe8e8cce145efe417.tar.gz
gcc-7488b5779f3d2c350ce7b2bfe8e8cce145efe417.tar.bz2
re PR c++/82054 (ICE in add_dwarf_attr with -fopenmp and -g)
2017-08-31 Richard Biener <rguenther@suse.de> PR middle-end/82054 * dwarf2out.c (dwarf2out_early_global_decl): Process each function only once. * g++.dg/gomp/pr82054.C: New testcase. From-SVN: r251559
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 42da36c..651dd0c 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -25492,9 +25492,10 @@ dwarf2out_early_global_decl (tree decl)
if (TREE_CODE (decl) != TYPE_DECL
&& TREE_CODE (decl) != PARM_DECL)
{
- tree save_fndecl = current_function_decl;
if (TREE_CODE (decl) == FUNCTION_DECL)
{
+ tree save_fndecl = current_function_decl;
+
/* For nested functions, make sure we have DIEs for the parents first
so that all nested DIEs are generated at the proper scope in the
first shot. */
@@ -25521,11 +25522,19 @@ dwarf2out_early_global_decl (tree decl)
dwarf2out_decl (origin);
}
- current_function_decl = decl;
+ /* Emit the DIE for decl but avoid doing that multiple times. */
+ dw_die_ref old_die;
+ if ((old_die = lookup_decl_die (decl)) == NULL
+ || is_declaration_die (old_die))
+ {
+ current_function_decl = decl;
+ dwarf2out_decl (decl);
+ }
+
+ current_function_decl = save_fndecl;
}
- dwarf2out_decl (decl);
- if (TREE_CODE (decl) == FUNCTION_DECL)
- current_function_decl = save_fndecl;
+ else
+ dwarf2out_decl (decl);
}
symtab->global_info_ready = save;
}