aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-sprintf.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@gcc.gnu.org>2017-01-10 14:54:15 -0700
committerMartin Sebor <msebor@gcc.gnu.org>2017-01-10 14:54:15 -0700
commiteb07c7cffb2ca361e793281ca142b2f8063aa0e1 (patch)
tree082ec7518c01c45d3ae0445135abb05700e30116 /gcc/gimple-ssa-sprintf.c
parentb9f4757f8eb94d4b145613ee5047f3f95452f9d2 (diff)
downloadgcc-eb07c7cffb2ca361e793281ca142b2f8063aa0e1.zip
gcc-eb07c7cffb2ca361e793281ca142b2f8063aa0e1.tar.gz
gcc-eb07c7cffb2ca361e793281ca142b2f8063aa0e1.tar.bz2
PR middle-end/78245 - missing -Wformat-length on an overflow of a dynamically allocated buffer
gcc/testsuite/ChangeLog: PR middle-end/78245 * gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: Add tests. gcc/ChangeLog: PR middle-end/78245 * gimple-ssa-sprintf.c (get_destination_size): Call {init,fini}object_sizes. * tree-object-size.c (addr_object_size): Adjust. (pass_through_call): Adjust. (pass_object_sizes::execute): Adjust. * tree-object-size.h (fini_object_sizes): Declare. From-SVN: r244293
Diffstat (limited to 'gcc/gimple-ssa-sprintf.c')
-rw-r--r--gcc/gimple-ssa-sprintf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 166b34b..9b327f6 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -2723,6 +2723,9 @@ get_destination_size (tree dest)
a member array as opposed to the whole enclosing object), otherwise
use type-zero object size to determine the size of the enclosing
object (the function fails without optimization in this type). */
+
+ init_object_sizes ();
+
int ost = optimize > 0;
unsigned HOST_WIDE_INT size;
if (compute_builtin_object_size (dest, ost, &size))
@@ -3120,6 +3123,8 @@ pass_sprintf_length::execute (function *fun)
}
}
+ fini_object_sizes ();
+
return 0;
}