aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-03-01 13:39:56 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-03-01 13:39:56 +0000
commitb476f5dd5d5aef9b150ad5d71dc46fd0b6207f73 (patch)
tree941783a864848aca2b46b958ef5b645b933600de
parent523036d4dcd25b8c0fe619b2e76a3795931e74ba (diff)
downloadgcc-b476f5dd5d5aef9b150ad5d71dc46fd0b6207f73.zip
gcc-b476f5dd5d5aef9b150ad5d71dc46fd0b6207f73.tar.gz
gcc-b476f5dd5d5aef9b150ad5d71dc46fd0b6207f73.tar.bz2
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 <rguenther@suse.de> 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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/dwarf2out.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/lto/pr84645_0.f9017
4 files changed, 32 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 447ea67..8796943 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-01 Richard Biener <rguenther@suse.de>
+
+ PR debug/84645
+ * dwarf2out.c (gen_variable_die): Properly handle late VLA
+ type annotation with LTO when debug was disabled at compile-time.
+
2018-03-01 Matthew Fortune <mfortune@gmail.com>
* config/mips/mips.c (mips_final_prescan_insn): Fix incorrect
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)))
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index e4ed421..a9e12be 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-03-01 Richard Biener <rguenther@suse.de>
+
+ PR debug/84645
+ * gfortran.dg/lto/pr84645_0.f90: New testcase.
+
2018-03-01 Paul Thomas <pault@gcc.gnu.org>
PR fortran/84219
diff --git a/gcc/testsuite/gfortran.dg/lto/pr84645_0.f90 b/gcc/testsuite/gfortran.dg/lto/pr84645_0.f90
new file mode 100644
index 0000000..9935624
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/lto/pr84645_0.f90
@@ -0,0 +1,17 @@
+! { dg-lto-do link }
+! { dg-lto-options { { -flto -g0 } } }
+! { dg-extra-ld-options { -g } }
+program nml_test
+ implicit none
+ type t
+ integer :: c1
+ integer :: c2(3)
+ end type t
+ call test2(2)
+contains
+ subroutine test2(n)
+ integer :: n
+ type(t) :: x12(n)
+ namelist /nml2/ x12
+ end subroutine test2
+end program nml_test