Commit c617fb56 by Jakub Jelinek Committed by Jakub Jelinek

re PR debug/85252 (ICE with -g for static zero-length array initialization)

	PR debug/85252
	* dwarf2out.c (rtl_for_decl_init): For STRING_CST initializer only
	build CONST_STRING if TYPE_MAX_VALUE is non-NULL and is INTEGER_CST.

	* gcc.dg/debug/pr85252.c: New test.

From-SVN: r259183
parent 49574486
2018-04-06 Jakub Jelinek <jakub@redhat.com>
PR debug/85252
* dwarf2out.c (rtl_for_decl_init): For STRING_CST initializer only
build CONST_STRING if TYPE_MAX_VALUE is non-NULL and is INTEGER_CST.
PR rtl-optimization/84872
* cfgloopmanip.c (create_preheader): Use make_forwarder_block even if
nentry == 1 when CP_FALLTHRU_PREHEADERS and single_entry is
......
......@@ -19596,6 +19596,8 @@ rtl_for_decl_init (tree init, tree type)
if (is_int_mode (TYPE_MODE (enttype), &mode)
&& GET_MODE_SIZE (mode) == 1
&& domain
&& TYPE_MAX_VALUE (domain)
&& TREE_CODE (TYPE_MAX_VALUE (domain)) == INTEGER_CST
&& integer_zerop (TYPE_MIN_VALUE (domain))
&& compare_tree_int (TYPE_MAX_VALUE (domain),
TREE_STRING_LENGTH (init) - 1) == 0
......
2018-04-06 Jakub Jelinek <jakub@redhat.com>
PR debug/85252
* gcc.dg/debug/pr85252.c: New test.
PR rtl-optimization/84872
* gcc.dg/graphite/pr84872.c: New test.
......
/* PR debug/85252 */
/* { dg-do compile } */
void
foo (void)
{
static char a[0] = "";
static char b[0] = "b"; /* { dg-warning "initializer-string for array of chars is too long" } */
static char c[1] = "c";
static char d[1] = "de"; /* { dg-warning "initializer-string for array of chars is too long" } */
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment