summaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-sprintf.c
diff options
context:
space:
mode:
authormsebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-10 21:54:15 +0000
committermsebor <msebor@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-10 21:54:15 +0000
commitd17f89dd0109493188137e12e6163efc5a45c287 (patch)
tree082ec7518c01c45d3ae0445135abb05700e30116 /gcc/gimple-ssa-sprintf.c
parent9348467c3f0f44a8c5a8e703e3a6c452d4de933b (diff)
downloadgcc-d17f89dd0109493188137e12e6163efc5a45c287.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@244293 138bc75d-0d04-0410-961f-82ee72b054a4
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 166b34ba37e..9b327f67fa9 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;
}