From b476f5dd5d5aef9b150ad5d71dc46fd0b6207f73 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 1 Mar 2018 13:39:56 +0000 Subject: re PR debug/84645 (-flto -g0 at compile-time vs. -flto -g at link time ICEs in add_dwarf_attr, at dwarf2out.c:4353) 2018-03-01 Richard Biener PR debug/84645 * dwarf2out.c (gen_variable_die): Properly handle late VLA type annotation with LTO when debug was disabled at compile-time. * gfortran.dg/lto/pr84645_0.f90: New testcase. From-SVN: r258100 --- gcc/dwarf2out.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'gcc/dwarf2out.c') diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 5e88c7b..41bb115 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -23527,10 +23527,12 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die) /* ??? In LTRANS we cannot annotate early created variably modified type DIEs without copying them and adjusting all - references to them. Thus we dumped them again, also add a - reference to them. */ + references to them. Thus we dumped them again. Also add a + reference to them but beware of -g0 compile and -g link + in which case the reference will be already present. */ tree type = TREE_TYPE (decl_or_origin); if (in_lto_p + && ! get_AT (var_die, DW_AT_type) && variably_modified_type_p (type, decl_function_context (decl_or_origin))) { -- cgit v1.1