From 8706773f5a11cc9f3f48e82e0177d047d275ce1d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 6 May 2016 07:44:22 +0000 Subject: [PATCH] re PR fortran/70931 (ICE with -g in native_encode_initializer, bei dwarf2out.c:17768) 2016-05-06 Richard Biener PR middle-end/70931 * dwarf2out.c (native_encode_initializer): Skip zero-sized fields. * gfortran.dg/pr70931.f90: New testcase. From-SVN: r235944 --- gcc/ChangeLog | 5 +++++ gcc/dwarf2out.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gfortran.dg/pr70931.f90 | 10 ++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/pr70931.f90 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e8f7c8f8e0e..3bf441a48f0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-05-06 Richard Biener + + PR middle-end/70931 + * dwarf2out.c (native_encode_initializer): Skip zero-sized fields. + 2016-05-06 Richard Biener PR middle-end/70941 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index ab851f4628b..fb3f7b9eb3c 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -17806,7 +17806,7 @@ native_encode_initializer (tree init, unsigned char *array, int size) fieldsize = tree_to_shwi (DECL_SIZE_UNIT (field)); pos = int_byte_position (field); gcc_assert (pos + fieldsize <= size); - if (val + if (val && fieldsize != 0 && !native_encode_initializer (val, array + pos, fieldsize)) return false; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d5b2df98e38..13f71217ced 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-05-06 Richard Biener + + PR middle-end/70931 + * gfortran.dg/pr70931.f90: New testcase. + 2016-05-06 Richard Biener PR middle-end/70941 diff --git a/gcc/testsuite/gfortran.dg/pr70931.f90 b/gcc/testsuite/gfortran.dg/pr70931.f90 new file mode 100644 index 00000000000..08ecd687752 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr70931.f90 @@ -0,0 +1,10 @@ +! { dg-do compile } +! { dg-options "-g" } +program p + type t + integer :: a + integer :: b(0) + end type + type(t), parameter :: z = t(1, [2]) + print *, z +end -- 2.30.2