diff options
author | Martin Sebor <msebor@redhat.com> | 2019-12-11 19:50:43 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2019-12-11 12:50:43 -0700 |
commit | f7d86b5ca830ca95899ec5e1585359f9baf19238 (patch) | |
tree | 2ccb64ec581e259d048fcc8de48cee51fbf37494 /gcc/builtins.c | |
parent | c7f5b4eddd8b11383074876e45863ae6b92a1357 (diff) | |
download | gcc-f7d86b5ca830ca95899ec5e1585359f9baf19238.zip gcc-f7d86b5ca830ca95899ec5e1585359f9baf19238.tar.gz gcc-f7d86b5ca830ca95899ec5e1585359f9baf19238.tar.bz2 |
builtins.c (compute_objsize): Add an argument and set it to offset into destination.
gcc/ChangeLog:
* builtins.c (compute_objsize): Add an argument and set it to offset
into destination.
* builtins.h (compute_objsize): Add an argument.
* tree-object-size.c (addr_object_size): Add an argument and set it
to offset into destination.
(compute_builtin_object_size): Same.
* tree-object-size.h (compute_builtin_object_size): Add an argument.
* tree-ssa-strlen.c (get_addr_stridx): Add an argument and set it
to offset into destination.
(maybe_warn_overflow): New function.
(handle_store): Call maybe_warn_overflow to issue warnings.
gcc/testsuite/ChangeLog:
* c-c++-common/Wstringop-overflow-2.c: Adjust text of expected messages.
* g++.dg/warn/Wstringop-overflow-3.C: Same.
* gcc.dg/Wstringop-overflow-17.c: Same.
From-SVN: r279248
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 205ac39..4c08214 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -3817,7 +3817,7 @@ compute_objsize (tree dest, int ostype, tree *pdecl /* = NULL */, /* Only the two least significant bits are meaningful. */ ostype &= 3; - if (compute_builtin_object_size (dest, ostype, &size, pdecl)) + if (compute_builtin_object_size (dest, ostype, &size, pdecl, poff)) return build_int_cst (sizetype, size); if (TREE_CODE (dest) == SSA_NAME) @@ -3924,7 +3924,7 @@ compute_objsize (tree dest, int ostype, tree *pdecl /* = NULL */, if (integer_zerop (size) && *pdecl && DECL_P (*pdecl) && *poff && integer_zerop (*poff)) - return integer_zero_node; + return size_zero_node; /* A valid offset into a declared object cannot be negative. */ if (tree_int_cst_sgn (*poff) < 0) |