diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-11-23 10:12:16 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-11-23 10:12:16 +0100 |
commit | 21150aba6ac0b00ce22b01a8d6104e5ea4e7c6ec (patch) | |
tree | ae6888cf4f54bb5e51d98fccdefbd48761ace20a /gcc/gimple-ssa-warn-restrict.c | |
parent | e0a35f9be5e08b33465999c90a0a3f09d4676da6 (diff) |
re PR tree-optimization/86614 (duplicate -Warray-bounds for a strncpy call with out-of-bounds offset)
PR tree-optimization/86614
* gimple-ssa-warn-restrict.c (maybe_diag_offset_bounds): Return early
if TREE_NO_WARNING is set on ref.ref.
* c-c++-common/Warray-bounds-2.c (wrap_strncpy_dstarray_diff_neg,
call_strncpy_dstarray_diff_neg): Don't expect late -Warray-bounds
warnings, just early ones from FE. Remove dg-prune-output.
* c-c++-common/Warray-bounds-6.c: New test.
From-SVN: r266403
Diffstat (limited to 'gcc/gimple-ssa-warn-restrict.c')
-rw-r--r-- | gcc/gimple-ssa-warn-restrict.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/gimple-ssa-warn-restrict.c b/gcc/gimple-ssa-warn-restrict.c index e3cbf42f2d9..035fbf88c11 100644 --- a/gcc/gimple-ssa-warn-restrict.c +++ b/gcc/gimple-ssa-warn-restrict.c @@ -1582,6 +1582,9 @@ maybe_diag_offset_bounds (location_t loc, gimple *call, tree func, int strict, if (!warn_array_bounds) return false; + if (ref.ref && TREE_NO_WARNING (ref.ref)) + return false; + offset_int ooboff[] = { ref.offrange[0], ref.offrange[1] }; tree oobref = ref.offset_out_of_bounds (strict, ooboff); if (!oobref) |