summaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2019-03-22 02:58:27 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2019-03-21 20:58:27 -0600
commita411ae9b355c739bf05c065fb2e1b748129c6894 (patch)
tree723e683acd41429480a4088f1a2c2804fe47ebd8 /gcc/builtins.c
parent11bf9a075a2d6ba4ee668e785fd2c478fa32f421 (diff)
PR tree-optimization/89350 - Wrong -Wstringop-overflow= warning since r261518
gcc/ChangeLog: PR tree-optimization/89350 * builtins.c (compute_objsize): Also ignore offsets whose upper bound is negative. * gimple-ssa-warn-restrict.c (builtin_memref): Add new member. (builtin_memref::builtin_memref): Initialize new member. Allow EXPR to be null. (builtin_memref::extend_offset_range): Replace local with a member. Avoid assuming pointer offsets are unsigned. (builtin_memref::set_base_and_offset): Determine base object before computing offset range. (builtin_access::builtin_access): Handle memset. (builtin_access::generic_overlap): Replace local with a member. (builtin_access::strcat_overlap): Same. (builtin_access::overlap): Same. (maybe_diag_overlap): Same. (maybe_diag_access_bounds): Same. (wrestrict_dom_walker::check_call): Handle memset. (check_bounds_or_overlap): Same. gcc/testsuite/ChangeLog: PR tree-optimization/89350 * gcc.dg/Wstringop-overflow.c: Xfail overly ambitious tests. * gcc.dg/Wstringop-overflow-11.c: New test. * gcc.dg/Wstringop-overflow-12.c: New test. * gcc.dg/pr89350.c: New test. * gcc.dg/pr40340-1.c: Adjust expected warning. * gcc.dg/pr40340-2.c: Same. * gcc.dg/pr40340-4.c: Same. * gcc.dg/pr40340-5.c: Same. From-SVN: r269867
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 93f829fa90b..daf5830011f 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -3650,7 +3650,8 @@ compute_objsize (tree dest, int ostype)
/* Ignore negative offsets for now. For others,
use the lower bound as the most optimistic
estimate of the (remaining)size. */
- if (wi::sign_mask (min))
+ if (wi::sign_mask (min)
+ || wi::sign_mask (max))
;
else if (wi::ltu_p (min, wisiz))
return wide_int_to_tree (TREE_TYPE (size),