[Bug debug/85252] ICE with -g for static zero-length array initialization

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Apr 6 11:40:00 GMT 2018


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid,
                   |                            |ice-on-invalid-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-04-06
                 CC|                            |jsm28 at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the initialization shouldn't have been accepted but rejected with an
error on the grounds the string doesn't fit.

QOI means that

#4  0x0000000000ac1d20 in rtl_for_decl_init (init=<string_cst 0x7ffff69d6978>, 
    type=<array_type 0x7ffff69c4a80>)
    at /space/rguenther/src/svn/early-lto-debug/gcc/dwarf2out.c:19602
19602                                  TREE_STRING_LENGTH (init) - 1) == 0
(gdb) l
19597         if (is_int_mode (TYPE_MODE (enttype), &mode)
19598             && GET_MODE_SIZE (mode) == 1
19599             && domain
19600             && integer_zerop (TYPE_MIN_VALUE (domain))
19601             && compare_tree_int (TYPE_MAX_VALUE (domain),
19602                                  TREE_STRING_LENGTH (init) - 1) == 0
19603             && ((size_t) TREE_STRING_LENGTH (init)
19604                 == strlen (TREE_STRING_POINTER (init)) + 1))

lacks a test for non-NULL TYPE_MAX_VALUE.  TYPE_DOMAIN is [0:] here.

Joseph?


More information about the Gcc-bugs mailing list