aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@gcc.gnu.org>2016-02-24 23:04:09 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-02-24 23:04:09 +0100
commit44293580369777e9fac3341133d6459b37c04672 (patch)
treeb3db00a1b0acd2842a23eaba38228934d7ea55fa /gcc/dwarf2out.c
parent03ca8fb3da94f12e5cd2ba57373d3875cd8d8cf8 (diff)
downloadgcc-44293580369777e9fac3341133d6459b37c04672.zip
gcc-44293580369777e9fac3341133d6459b37c04672.tar.gz
gcc-44293580369777e9fac3341133d6459b37c04672.tar.bz2
re PR debug/69705 (segfault in libgomp.fortran/task1.f90 with -flto -fno-use-linker-plugin -fno-toplevel-reorder -O1 -g)
PR debug/69705 * dwarf2out.c (gen_variable_die): Work around buggy LTO - allow NULL decl for Fortran DW_TAG_common_block variables. From-SVN: r233685
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index d8ca1b7..97e192b 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -21055,7 +21055,7 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
DW_TAG_common_block and DW_TAG_variable. */
loc = loc_list_from_tree (com_decl, 2, NULL);
}
- else if (DECL_EXTERNAL (decl))
+ else if (DECL_EXTERNAL (decl_or_origin))
add_AT_flag (com_die, DW_AT_declaration, 1);
if (want_pubnames ())
add_pubname_string (cnam, com_die); /* ??? needed? */
@@ -21070,8 +21070,9 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
remove_AT (com_die, DW_AT_declaration);
}
var_die = new_die (DW_TAG_variable, com_die, decl);
- add_name_and_src_coords_attributes (var_die, decl);
- add_type_attribute (var_die, TREE_TYPE (decl), decl_quals (decl), false,
+ add_name_and_src_coords_attributes (var_die, decl_or_origin);
+ add_type_attribute (var_die, TREE_TYPE (decl_or_origin),
+ decl_quals (decl_or_origin), false,
context_die);
add_AT_flag (var_die, DW_AT_external, 1);
if (loc)
@@ -21093,9 +21094,10 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
}
add_AT_location_description (var_die, DW_AT_location, loc);
}
- else if (DECL_EXTERNAL (decl))
+ else if (DECL_EXTERNAL (decl_or_origin))
add_AT_flag (var_die, DW_AT_declaration, 1);
- equate_decl_number_to_die (decl, var_die);
+ if (decl)
+ equate_decl_number_to_die (decl, var_die);
return;
}