summaryrefslogtreecommitdiff
path: root/gcc/print-tree.c
diff options
context:
space:
mode:
authormsebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4>2016-09-21 01:39:27 +0000
committermsebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4>2016-09-21 01:39:27 +0000
commitb9833bfd04471afa17cd52aedd911e4671bdd82a (patch)
tree31a2a49deedcccbfcfdac5857b76449a9235f4a1 /gcc/print-tree.c
parent57d3d9b2b80228480a17f7133a570e142c4e27c1 (diff)
downloadgcc-b9833bfd04471afa17cd52aedd911e4671bdd82a.tar.gz
PR middle-end/49905 - Better sanity checking on sprintf src & dest to
gcc/ChangeLog: PR middle-end/49905 * Makefile.in (OBJS): Add gimple-ssa-sprintf.o. * config/linux.h (TARGET_PRINTF_POINTER_FORMAT): Redefine. * config/linux.c (gnu_libc_printf_pointer_format): New function. * config/sol2.h (TARGET_PRINTF_POINTER_FORMAT): Same. * config/sol2.c (solaris_printf_pointer_format): New function. * doc/invoke.texi (-Wformat-length, -fprintf-return-value): New options. * doc/tm.texi.in (TARGET_PRINTF_POINTER_FORMAT): Document. * doc/tm.texi: Regenerate. * gimple-fold.h (get_range_strlen): New function. (get_maxval_strlen): Declare existing function. * gimple-fold.c (get_range_strlen): Add arguments and compute both maximum and minimum. (get_range_strlen): Define overload. (get_maxval_strlen): Adjust. * gimple-ssa-sprintf.c: New file and pass. * passes.def (pass_sprintf_length): Add new pass. * targhooks.h (default_printf_pointer_format): Declare new function. (gnu_libc_printf_pointer_format): Same. (solaris_libc_printf_pointer_format): Same. * targhooks.c (default_printf_pointer_format): Define new function. * tree-pass.h (make_pass_sprintf_length): Declare new function. * print-tree.c: Increase buffer size. gcc/c-family/ChangeLog: PR middle-end/49905 * c.opt: Add -Wformat-length and -fprintf-return-value. gcc/testsuite/ChangeLog: PR middle-end/49905 * gcc.dg/builtin-stringop-chk-1.c: Adjust. * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-warn-2.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-warn-4.c: New test. * gcc.dg/tree-ssa/builtin-sprintf.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-2.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240298 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/print-tree.c')
-rw-r--r--gcc/print-tree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index e55b6bd6fb6..60957f95259 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -769,7 +769,8 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
case VECTOR_CST:
{
- char buf[10];
+ /* Big enough for 2 UINT_MAX plus the string below. */
+ char buf[32];
unsigned i;
for (i = 0; i < VECTOR_CST_NELTS (node); ++i)