From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7832) id C16A53857823; Tue, 22 Mar 2022 05:41:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C16A53857823 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Qian Jianhua To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-7748] print-tree:Avoid warnings of overflow X-Act-Checkin: gcc X-Git-Author: Qian Jianhua X-Git-Refname: refs/heads/master X-Git-Oldrev: 7bce0be03b857eefe5990c3ef0af06ea8f8ae04e X-Git-Newrev: c6bc4835659d24edc2bf5de13bfe8f59ae409ff3 Message-Id: <20220322054114.C16A53857823@sourceware.org> Date: Tue, 22 Mar 2022 05:41:14 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Mar 2022 05:41:14 -0000 https://gcc.gnu.org/g:c6bc4835659d24edc2bf5de13bfe8f59ae409ff3 commit r12-7748-gc6bc4835659d24edc2bf5de13bfe8f59ae409ff3 Author: Qian Jianhua 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); }