* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@259183
138bc75d-0d04-0410-961f-
82ee72b054a4
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
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.
--- /dev/null
+/* 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" } */
+}