[Bug fortran/70931] [4.9/5/6/7 Regression] ICE with -g in native_encode_initializer, bei dwarf2out.c:17768

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 4 09:07:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70931

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.4

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think this is a corner-case of native_encode_initializer not handling
zero-sized FIELD_DECLs.

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c     (revision 235859)
+++ gcc/dwarf2out.c     (working copy)
@@ -17806,7 +17806,7 @@ native_encode_initializer (tree init, un
              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;
            }

fixes it.


More information about the Gcc-bugs mailing list