PR tree-optimization/83456 - -Wrestrict false positive on a non-overlapping memcpy...
authorMartin Sebor <msebor@redhat.com>
Mon, 12 Mar 2018 18:04:16 +0000 (18:04 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Mon, 12 Mar 2018 18:04:16 +0000 (12:04 -0600)
commite9b9fa4cdaedd40ab429c0c98e8801ae039a33e9
tree3fbe1a5f54834ad2c8f3f4f8d5572933ad7b9ae0
parentdf4cfec5540bfb982bfec374346493bed6608fa4
PR tree-optimization/83456 - -Wrestrict false positive on a non-overlapping memcpy in an inline function

gcc/ChangeLog:

PR tree-optimization/83456
* gimple-fold.c (gimple_fold_builtin_memory_op): Avoid warning
for perfectly overlapping calls to memcpy.
(gimple_fold_builtin_memory_chk): Same.
(gimple_fold_builtin_strcpy): Handle no-warning.
(gimple_fold_builtin_stxcpy_chk): Same.
* tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Handle no-warning.

gcc/c-family/ChangeLog:

PR tree-optimization/83456
* gcc/c-family/c-common.c (check_function_restrict): Return bool.
Restore checking of bounded built-in functions.
(check_function_arguments): Also return the result
of warn_for_restrict.
* gcc/c-family/c-common.c (check_function_restrict): Return bool.
* gcc/c-family/c-warn.c (warn_for_restrict): Return bool.

gcc/testsuite/ChangeLog:

PR tree-optimization/83456
* c-c++-common/Wrestrict-2.c: Remove test cases.
* c-c++-common/Wrestrict.c: Same.
* gcc.dg/Wrestrict-12.c: New test.
* gcc.dg/Wrestrict-14.c: New test.

From-SVN: r258455
12 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c-family/c-common.h
gcc/c-family/c-warn.c
gcc/gimple-fold.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/Wrestrict-2.c
gcc/testsuite/c-c++-common/Wrestrict.c
gcc/testsuite/gcc.dg/Wrestrict-12.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/Wrestrict-14.c [new file with mode: 0644]
gcc/tree-ssa-strlen.c