From: Qian Jianhua Date: Tue, 22 Mar 2022 00:44:51 +0000 (+0800) Subject: print-tree:Avoid warnings of overflow X-Git-Tag: upstream/12.2.0~949 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c6bc4835659d24edc2bf5de13bfe8f59ae409ff3;p=platform%2Fupstream%2Fgcc.git print-tree:Avoid warnings of overflow This patch avoids two warnings of "'sprintf' may write a terminating nul past the end of the destination [-Wformat-overflow=]" when build GCC. Tested on x86_64, and committed as obvious. gcc/ChangeLog: * print-tree.cc: Change array length --- diff --git a/gcc/print-tree.cc b/gcc/print-tree.cc index 0876da8..6d45a4a 100644 --- a/gcc/print-tree.cc +++ b/gcc/print-tree.cc @@ -776,7 +776,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent, { /* Buffer big enough to format a 32-bit UINT_MAX into, plus the text. */ - char temp[15]; + char temp[16]; sprintf (temp, "arg:%d", i); print_node (file, temp, TREE_OPERAND (node, i), indent + 4); @@ -886,7 +886,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent, { /* Buffer big enough to format a 32-bit UINT_MAX into, plus the text. */ - char temp[15]; + char temp[16]; sprintf (temp, "elt:%d", i); print_node (file, temp, TREE_VEC_ELT (node, i), indent + 4); }