public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-7748] print-tree:Avoid warnings of overflow
@ 2022-03-22 5:41 Qian Jianhua
0 siblings, 0 replies; only message in thread
From: Qian Jianhua @ 2022-03-22 5:41 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:c6bc4835659d24edc2bf5de13bfe8f59ae409ff3
commit r12-7748-gc6bc4835659d24edc2bf5de13bfe8f59ae409ff3
Author: Qian Jianhua <qianjh@cn.fujitsu.com>
Date: Tue Mar 22 08:44:51 2022 +0800
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:
---
gcc/print-tree.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-22 5:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 5:41 [gcc r12-7748] print-tree:Avoid warnings of overflow Qian Jianhua
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).