diff mbox series

[COMMITTED] print-tree:Avoid warnings of overflow

Message ID 20220322054212.9838-1-qianjh@cn.fujitsu.com
State New
Headers show
Series [COMMITTED] print-tree:Avoid warnings of overflow | expand

Commit Message

Qian Jianhua March 22, 2022, 5:42 a.m. UTC
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
---
 gcc/print-tree.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/print-tree.cc b/gcc/print-tree.cc
index 0876da873a9..6d45a4a5966 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);
 	      }